Ticket #3238: trigger-STmode.patch
File trigger-STmode.patch, 2.4 KB (added by , 9 years ago) |
---|
-
source/simulation2/Simulation2.cpp
103 103 104 104 static bool LoadDefaultScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts); 105 105 static bool LoadScripts(CComponentManager& componentManager, std::set<VfsPath>* loadedScripts, const VfsPath& path); 106 static bool LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue mapSettings, std::set<VfsPath>* loadedScripts );106 static bool LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue mapSettings, std::set<VfsPath>* loadedScripts, bool acceptMultipleLoad = false); 107 107 Status ReloadChangedFile(const VfsPath& path); 108 108 109 109 static Status ReloadChangedFileCB(void* param, const VfsPath& path) … … 199 199 return ok; 200 200 } 201 201 202 bool CSimulation2Impl::LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue mapSettings, std::set<VfsPath>* loadedScripts )202 bool CSimulation2Impl::LoadTriggerScripts(CComponentManager& componentManager, JS::HandleValue mapSettings, std::set<VfsPath>* loadedScripts, bool acceptMultipleLoad) 203 203 { 204 204 bool ok = true; 205 205 if (componentManager.GetScriptInterface().HasProperty(mapSettings, "TriggerScripts")) … … 211 211 std::string scriptName = "maps/" + scriptNames[i]; 212 212 if (loadedScripts) 213 213 { 214 if ( loadedScripts->find(scriptName) != loadedScripts->end())214 if (!acceptMultipleLoad && loadedScripts->find(scriptName) != loadedScripts->end()) 215 215 return true; 216 216 loadedScripts->insert(scriptName); 217 217 } … … 371 371 ResetComponentState(secondaryComponentManager, false, false); 372 372 373 373 // Load the trigger scripts after we have loaded the simulation. 374 // Make sure scripts are not discarded because already loaded in the first simulation. 374 375 { 375 376 JSContext* cx2 = secondaryComponentManager.GetScriptInterface().GetContext(); 376 377 JSAutoRequest rq2(cx2); … … 377 378 JS::RootedValue mapSettingsCloned(cx2, 378 379 secondaryComponentManager.GetScriptInterface().CloneValueFromOtherContext( 379 380 scriptInterface, m_MapSettings)); 380 ENSURE(LoadTriggerScripts(secondaryComponentManager, mapSettingsCloned, &m_LoadedScripts ));381 ENSURE(LoadTriggerScripts(secondaryComponentManager, mapSettingsCloned, &m_LoadedScripts, true)); 381 382 } 382 383 383 384 // Load the map into the secondary simulation