mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
flag game as ended when player dies
This commit is contained in:
parent
82c8495338
commit
f45cff8aff
@ -39,6 +39,8 @@ namespace MWBase
|
||||
///< Start a new game.
|
||||
///
|
||||
/// \param bypass Skip new game mechanics.
|
||||
|
||||
virtual void endGame() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/statemanager.hpp"
|
||||
|
||||
#include "npcstats.hpp"
|
||||
#include "creaturestats.hpp"
|
||||
@ -344,20 +345,24 @@ namespace MWMechanics
|
||||
continue;
|
||||
}
|
||||
|
||||
// If it's the player and God Mode is turned on, keep it alive
|
||||
if(iter->first.getRefData().getHandle()=="player" &&
|
||||
MWBase::Environment::get().getWorld()->getGodModeState())
|
||||
if (iter->first.getRefData().getHandle()=="player")
|
||||
{
|
||||
MWMechanics::DynamicStat<float> stat(stats.getHealth());
|
||||
|
||||
if(stat.getModified()<1)
|
||||
// If it's the player and God Mode is turned on, keep it alive
|
||||
if (MWBase::Environment::get().getWorld()->getGodModeState())
|
||||
{
|
||||
stat.setModified(1, 0);
|
||||
stats.setHealth(stat);
|
||||
MWMechanics::DynamicStat<float> stat (stats.getHealth());
|
||||
|
||||
if (stat.getModified()<1)
|
||||
{
|
||||
stat.setModified(1, 0);
|
||||
stats.setHealth(stat);
|
||||
}
|
||||
|
||||
stats.resurrect();
|
||||
continue;
|
||||
}
|
||||
|
||||
stats.resurrect();
|
||||
continue;
|
||||
MWBase::Environment::get().getStateManager()->endGame();
|
||||
}
|
||||
|
||||
if(iter->second->isDead())
|
||||
|
@ -46,3 +46,8 @@ void MWState::StateManager::newGame (bool bypass)
|
||||
|
||||
mState = State_Running;
|
||||
}
|
||||
|
||||
void MWState::StateManager::endGame()
|
||||
{
|
||||
mState = State_Ended;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ namespace MWState
|
||||
///< Start a new game.
|
||||
///
|
||||
/// \param bypass Skip new game mechanics.
|
||||
|
||||
virtual void endGame();
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user