1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-20 22:23:52 +00:00

move starting of startup scripts from engine startup to new game start; also restart all startup scripts on saved game load

This commit is contained in:
Marc Zinnschlag 2014-07-25 12:17:15 +02:00
parent 5e543ac806
commit d0654f3ade
2 changed files with 5 additions and 2 deletions

View file

@ -421,8 +421,6 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
mOgre->getRoot()->addFrameListener (this);
// scripts
mEnvironment.getScriptManager()->getGlobalScripts().addStartup();
if (mCompileAll)
{
std::pair<int, int> result = MWBase::Environment::get().getScriptManager()->compileAll();

View file

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