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.
deque
scrawl 11 years ago
parent abd6b6ab33
commit 9fe505c8fa

@ -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())

Loading…
Cancel
Save