]> git.stg.codes - stg.git/commitdiff
Ticket 26. In the reload() function modSettings vector is defined, a cycle for the
authorElena Mamontova <helenh463@gmail.com>
Fri, 19 Feb 2016 14:01:35 +0000 (16:01 +0200)
committerElena Mamontova <helenh463@gmail.com>
Fri, 19 Feb 2016 14:01:35 +0000 (16:01 +0200)
modSettins vector is added, the modSettings[j] parameter is added in the
m_modules[i]->Reload() function.

projects/stargazer/plugin_mgr.cpp

index d3430c8927d3b86f6b4671ca665af4126235301e..b7ead90d9777cb700bc63b3df7231a529c87a11d 100644 (file)
@@ -121,15 +121,22 @@ PluginManager::~PluginManager()
 
 void PluginManager::reload(const SETTINGS_IMPL& settings)
 {
+    const std::vector<MODULE_SETTINGS> & modSettings(settings.GetModulesSettings());
     for (size_t i = 0; i < m_modules.size(); ++i)
     {
-        PLUGIN & plugin = m_modules[i]->GetPlugin();
-        if (m_modules[i]->Reload())
+        for (size_t j = 0; j < modSettings.size(); j++)
         {
-            m_log("Error reloading module '%s': '%s'", plugin.GetVersion().c_str(),
-                                                       plugin.GetStrError().c_str());
-            printfd(__FILE__, "Error reloading module '%s': '%s'\n", plugin.GetVersion().c_str(),
-                                                                     plugin.GetStrError().c_str());
+           if (modSettings[j].moduleName == m_modules[i]->GetName()) 
+           {
+                PLUGIN & plugin = m_modules[i]->GetPlugin();
+                if (m_modules[i]->Reload(modSettings[j]))
+                {
+                    m_log("Error reloading module '%s': '%s'", plugin.GetVersion().c_str(),
+                                                               plugin.GetStrError().c_str());
+                    printfd(__FILE__, "Error reloading module '%s': '%s'\n", plugin.GetVersion().c_str(),
+                                                                             plugin.GetStrError().c_str());
+                }
+           }
         }
     }
 }