Skip to content

Commit

Permalink
Add resumeGame method
Browse files Browse the repository at this point in the history
  • Loading branch information
Capostrophic committed Jul 26, 2018
1 parent 84b80ae commit 51d369d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@
Bug #2326: After a bound item expires the last equipped item of that type is not automatically re-equipped
Bug #2455: Creatures attacks degrade armor
Bug #2562: Forcing AI to activate a teleport door sometimes causes a crash
Bug #2626: Resurrecting the player does not resume the game
Bug #2772: Non-existing class or faction freezes the game
Bug #2835: Player able to slowly move when overencumbered
Bug #2852: No murder bounty when a player follower commits murder
Expand Down
2 changes: 2 additions & 0 deletions apps/openmw/mwbase/statemanager.hpp
Expand Up @@ -55,6 +55,8 @@ namespace MWBase

virtual void endGame() = 0;

virtual void resumeGame() = 0;

virtual void deleteGame (const MWState::Character *character, const MWState::Slot *slot) = 0;

virtual void saveGame (const std::string& description, const MWState::Slot *slot = 0) = 0;
Expand Down
5 changes: 5 additions & 0 deletions apps/openmw/mwscript/statsextensions.cpp
Expand Up @@ -17,6 +17,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/statemanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp"

Expand Down Expand Up @@ -1139,7 +1140,11 @@ namespace MWScript
MWWorld::Ptr ptr = R()(runtime);

if (ptr == MWMechanics::getPlayer())
{
ptr.getClass().getCreatureStats(ptr).resurrect();
if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_Ended)
MWBase::Environment::get().getStateManager()->resumeGame();
}
else if (ptr.getClass().getCreatureStats(ptr).isDead())
{
bool wasEnabled = ptr.getRefData().isEnabled();
Expand Down
5 changes: 5 additions & 0 deletions apps/openmw/mwstate/statemanagerimp.cpp
Expand Up @@ -173,6 +173,11 @@ void MWState::StateManager::endGame()
mState = State_Ended;
}

void MWState::StateManager::resumeGame()
{
mState = State_Running;
}

void MWState::StateManager::saveGame (const std::string& description, const Slot *slot)
{
MWState::Character* character = getCurrentCharacter();
Expand Down
2 changes: 2 additions & 0 deletions apps/openmw/mwstate/statemanagerimp.hpp
Expand Up @@ -48,6 +48,8 @@ namespace MWState

virtual void endGame();

virtual void resumeGame();

virtual void deleteGame (const MWState::Character *character, const MWState::Slot *slot);
///< Delete a saved game slot from this character. If all save slots are deleted, the character will be deleted too.

Expand Down

0 comments on commit 51d369d

Please sign in to comment.