1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Only run --script-run commands when bypassing the menu

Running them while no game is started yet is dangerous, and also leaves bits and pieces of state (e.g. in LocalScripts for scripted items added to inventory) that will not get cleaned up properly when a game is loaded (since when no game was previously running, no cleanup is performed). As a result, dangling MWWorld::Ptrs were left in LocalScripts.
This commit is contained in:
scrawl 2014-05-20 18:35:17 +02:00
parent abd6b6ab33
commit 9fe505c8fa

View File

@ -462,10 +462,12 @@ void OMW::Engine::go()
catch (...) {}
}
else
{
MWBase::Environment::get().getStateManager()->newGame (true);
if (!mStartupScript.empty())
MWBase::Environment::get().getWindowManager()->executeInConsole (mStartupScript);
if (!mStartupScript.empty())
MWBase::Environment::get().getWindowManager()->executeInConsole (mStartupScript);
}
// Start the main rendering loop
while (!mEnvironment.get().getStateManager()->hasQuitRequest())