From d0654f3adefc86a82641a7435e4b84682e606600 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 25 Jul 2014 12:17:15 +0200 Subject: [PATCH] move starting of startup scripts from engine startup to new game start; also restart all startup scripts on saved game load --- apps/openmw/engine.cpp | 2 -- apps/openmw/mwstate/statemanagerimp.cpp | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 6a48789a5e..66eae5f5db 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -421,8 +421,6 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) mOgre->getRoot()->addFrameListener (this); // scripts - mEnvironment.getScriptManager()->getGlobalScripts().addStartup(); - if (mCompileAll) { std::pair result = MWBase::Environment::get().getScriptManager()->compileAll(); diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index a3604cc66e..b69e6b9089 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -139,6 +139,9 @@ void MWState::StateManager::newGame (bool bypass) else MWBase::Environment::get().getWorld()->setGlobalInt ("chargenstate", -1); + + MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup(); + mState = State_Running; } @@ -401,6 +404,8 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl // Use detectWorldSpaceChange=false, otherwise some of the data we just loaded would be cleared again MWBase::Environment::get().getWorld()->changeToCell (cellId, ptr.getRefData().getPosition(), false); + MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup(); + // Do not trigger erroneous cellChanged events MWBase::Environment::get().getWorld()->markCellAsUnchanged(); }