mirror of https://github.com/OpenRCT2/OpenRCT2.git
Restart plugins when starting new game from a game
This commit is contained in:
parent
3596480016
commit
d7d880dc23
|
@ -91,6 +91,10 @@ void ScriptEngine::LoadPlugins()
|
|||
{
|
||||
Initialise();
|
||||
}
|
||||
if (_pluginsLoaded)
|
||||
{
|
||||
UnloadPlugins();
|
||||
}
|
||||
|
||||
auto base = _env.GetDirectoryPath(DIRBASE::USER, DIRID::PLUGIN);
|
||||
if (Path::DirectoryExists(base))
|
||||
|
@ -112,6 +116,7 @@ void ScriptEngine::LoadPlugins()
|
|||
}
|
||||
}
|
||||
_pluginsLoaded = true;
|
||||
_pluginsStarted = false;
|
||||
}
|
||||
|
||||
void ScriptEngine::LoadPlugin(const std::string& path)
|
||||
|
@ -237,6 +242,7 @@ void ScriptEngine::StartPlugins()
|
|||
ScriptExecutionInfo::PluginScope scope(_execInfo, plugin);
|
||||
try
|
||||
{
|
||||
LogPluginInfo(plugin, "Started");
|
||||
plugin->Start();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -253,6 +259,7 @@ void ScriptEngine::StopPlugins()
|
|||
for (auto& plugin : _plugins)
|
||||
{
|
||||
StopPlugin(plugin);
|
||||
LogPluginInfo(plugin, "Stopped");
|
||||
}
|
||||
_pluginsStarted = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue