From 4e23b5ff6e8005d77f415038beb9c8e6ebe283cc Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Tue, 3 Aug 2010 17:44:28 -0400 Subject: Fix compilation, add sorted ->init() calls to modmanager_static --- src/modmanager_static.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'src/modmanager_static.cpp') diff --git a/src/modmanager_static.cpp b/src/modmanager_static.cpp index aa48b2d0a..9c5457cd9 100644 --- a/src/modmanager_static.cpp +++ b/src/modmanager_static.cpp @@ -184,22 +184,6 @@ void ModuleManager::LoadAll() } } - for(std::map::iterator i = Modules.begin(); i != Modules.end(); i++) - { - Module* mod = i->second; - try - { - mod->init(); - } - catch (CoreException& modexcept) - { - LastModuleError = "Unable to initialize " + mod->ModuleSourceFile + ": " + modexcept.GetReason(); - ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); - printf_c("\n[\033[1;31m*\033[0m] %s\n\n", LastModuleError.c_str()); - ServerInstance->Exit(EXIT_STATUS_MODULE); - } - } - /* We give every module a chance to re-prioritize when we introduce a new one, * not just the one thats loading, as the new module could affect the preference * of others @@ -218,6 +202,25 @@ void ModuleManager::LoadAll() ServerInstance->Exit(EXIT_STATUS_MODULE); } } + + IntModuleList& initlist = EventHandlers[I_ModuleInit]; + for(size_t i=0; i < initlist.size(); i++) + { + Module* mod = initlist[i]; + try + { + ServerInstance->Logs->Log("MODULE", DEBUG, "Initializing %s", mod->ModuleSourceFile.c_str()); + mod->init(); + } + catch (CoreException& modexcept) + { + LastModuleError = "Unable to initialize " + mod->ModuleSourceFile + ": " + modexcept.GetReason(); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); + printf_c("\n[\033[1;31m*\033[0m] %s\n\n", LastModuleError.c_str()); + ServerInstance->Exit(EXIT_STATUS_MODULE); + } + } + initlist.clear(); } #endif -- cgit v1.3.1-10-gc9f91