- modules[this->ModCount+1]->Implements(x);
-
- for(int t = 0; t < 255; t++)
- Instance->Config->global_implementation[t] += Instance->Config->implement_lists[this->ModCount+1][t];
- }
- else
- {
- Instance->Log(DEFAULT, "Unable to load %s",modfile);
- snprintf(MODERR,MAXBUF, "Probably missing init_module() entrypoint, but dlsym() didn't notice a problem");
- return false;
- }
- }
- catch (LoadModuleException& modexcept)
- {
- Instance->Log(DEFAULT,"Unable to load %s: %s", modfile, modexcept.GetReason());
- snprintf(MODERR,MAXBUF,"Loader/Linker error: %s", modexcept.GetReason());
- return false;
- }
- catch (FindSymbolException& modexcept)
- {
- Instance->Log(DEFAULT,"Unable to load %s: %s", modfile, modexcept.GetReason());
- snprintf(MODERR,MAXBUF,"Loader/Linker error: %s", modexcept.GetReason());
- return false;
- }
- catch (CoreException& modexcept)
- {
- Instance->Log(DEFAULT,"Unable to load %s: %s",modfile,modexcept.GetReason());
- snprintf(MODERR,MAXBUF,"Factory function of %s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
- return false;
- }
-
- this->ModCount++;
- FOREACH_MOD_I(Instance,I_OnLoadModule,OnLoadModule(modules[this->ModCount],filename_str));
- // now work out which modules, if any, want to move to the back of the queue,
- // and if they do, move them there.
- std::vector<std::string> put_to_back;
- std::vector<std::string> put_to_front;
- std::map<std::string,std::string> put_before;
- std::map<std::string,std::string> put_after;
- for (unsigned int j = 0; j < Instance->Config->module_names.size(); j++)
- {
- if (modules[j]->Prioritize() == PRIORITY_LAST)
- put_to_back.push_back(Instance->Config->module_names[j]);
- else if (modules[j]->Prioritize() == PRIORITY_FIRST)
- put_to_front.push_back(Instance->Config->module_names[j]);
- else if ((modules[j]->Prioritize() & 0xFF) == PRIORITY_BEFORE)
- put_before[Instance->Config->module_names[j]] = Instance->Config->module_names[modules[j]->Prioritize() >> 8];
- else if ((modules[j]->Prioritize() & 0xFF) == PRIORITY_AFTER)
- put_after[Instance->Config->module_names[j]] = Instance->Config->module_names[modules[j]->Prioritize() >> 8];
- }
- for (unsigned int j = 0; j < put_to_back.size(); j++)
- MoveToLast(put_to_back[j]);
- for (unsigned int j = 0; j < put_to_front.size(); j++)
- MoveToFirst(put_to_front[j]);
- for (std::map<std::string,std::string>::iterator j = put_before.begin(); j != put_before.end(); j++)
- MoveBefore(j->first,j->second);
- for (std::map<std::string,std::string>::iterator j = put_after.begin(); j != put_after.end(); j++)
- MoveAfter(j->first,j->second);
- Instance->BuildISupport();