Fix statemanager cleanup setting game state to ended by accident

ini_importer_tests
uramer 11 months ago
parent 8c6a1ae8c0
commit 02accd7a49

@ -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,16 +62,19 @@ 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();
}
MWBase::Environment::get().getLuaManager()->clear();
}
std::map<int, int> MWState::StateManager::buildContentFileIndexMap(const ESM::ESMReader& reader) const

Loading…
Cancel
Save