mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 00:53: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:
parent
5e543ac806
commit
d0654f3ade
2 changed files with 5 additions and 2 deletions
|
@ -421,8 +421,6 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
mOgre->getRoot()->addFrameListener (this);
|
mOgre->getRoot()->addFrameListener (this);
|
||||||
|
|
||||||
// scripts
|
// scripts
|
||||||
mEnvironment.getScriptManager()->getGlobalScripts().addStartup();
|
|
||||||
|
|
||||||
if (mCompileAll)
|
if (mCompileAll)
|
||||||
{
|
{
|
||||||
std::pair<int, int> result = MWBase::Environment::get().getScriptManager()->compileAll();
|
std::pair<int, int> result = MWBase::Environment::get().getScriptManager()->compileAll();
|
||||||
|
|
|
@ -139,6 +139,9 @@ void MWState::StateManager::newGame (bool bypass)
|
||||||
else
|
else
|
||||||
MWBase::Environment::get().getWorld()->setGlobalInt ("chargenstate", -1);
|
MWBase::Environment::get().getWorld()->setGlobalInt ("chargenstate", -1);
|
||||||
|
|
||||||
|
|
||||||
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
|
||||||
|
|
||||||
mState = State_Running;
|
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
|
// 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().getWorld()->changeToCell (cellId, ptr.getRefData().getPosition(), false);
|
||||||
|
|
||||||
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
|
||||||
|
|
||||||
// Do not trigger erroneous cellChanged events
|
// Do not trigger erroneous cellChanged events
|
||||||
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
|
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue