mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:53:52 +00:00
Fix statemanager cleanup setting game state to ended by accident
This commit is contained in:
parent
8c6a1ae8c0
commit
02accd7a49
4 changed files with 15 additions and 4 deletions
|
@ -56,6 +56,7 @@ namespace MWBase
|
|||
virtual void newGameStarted() = 0;
|
||||
virtual void gameLoaded() = 0;
|
||||
virtual void gameEnded() = 0;
|
||||
virtual void noGame() = 0;
|
||||
virtual void objectAddedToScene(const MWWorld::Ptr& ptr) = 0;
|
||||
virtual void objectRemovedFromScene(const MWWorld::Ptr& ptr) = 0;
|
||||
virtual void objectTeleported(const MWWorld::Ptr& ptr) = 0;
|
||||
|
|
|
@ -379,6 +379,12 @@ namespace MWLua
|
|||
mMenuScripts.stateChanged();
|
||||
}
|
||||
|
||||
void LuaManager::noGame()
|
||||
{
|
||||
clear();
|
||||
mMenuScripts.stateChanged();
|
||||
}
|
||||
|
||||
void LuaManager::uiModeChanged(const MWWorld::Ptr& arg)
|
||||
{
|
||||
if (mPlayer.isEmpty())
|
||||
|
|
|
@ -70,6 +70,7 @@ namespace MWLua
|
|||
void newGameStarted() override;
|
||||
void gameLoaded() override;
|
||||
void gameEnded() override;
|
||||
void noGame() override;
|
||||
void objectAddedToScene(const MWWorld::Ptr& ptr) override;
|
||||
void objectRemovedFromScene(const MWWorld::Ptr& ptr) override;
|
||||
void inputEvent(const InputEvent& event) override;
|
||||
|
|
|
@ -62,17 +62,20 @@ void MWState::StateManager::cleanup(bool force)
|
|||
MWBase::Environment::get().getInputManager()->clear();
|
||||
MWBase::Environment::get().getMechanicsManager()->clear();
|
||||
|
||||
mState = State_NoGame;
|
||||
mCharacterManager.setCurrentCharacter(nullptr);
|
||||
mTimePlayed = 0;
|
||||
mLastSavegame.clear();
|
||||
|
||||
MWMechanics::CreatureStats::cleanup();
|
||||
|
||||
endGame();
|
||||
mState = State_NoGame;
|
||||
MWBase::Environment::get().getLuaManager()->noGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: do we need this cleanup?
|
||||
MWBase::Environment::get().getLuaManager()->clear();
|
||||
}
|
||||
}
|
||||
|
||||
std::map<int, int> MWState::StateManager::buildContentFileIndexMap(const ESM::ESMReader& reader) const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue