mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-18 13:12:50 +00:00
Fix a crash after loading game
This commit is contained in:
parent
42b332775a
commit
5b011e43a7
@ -52,7 +52,7 @@ namespace MWGui
|
||||
, mWeaponVisible(true)
|
||||
, mSpellVisible(true)
|
||||
, mWorldMouseOver(false)
|
||||
, mEnemyHealthTimer(0)
|
||||
, mEnemyHealthTimer(-1)
|
||||
, mIsDrowning(false)
|
||||
, mWeaponSpellTimer(0.f)
|
||||
, mDrowningFlashTheta(0.f)
|
||||
@ -639,4 +639,10 @@ namespace MWGui
|
||||
updateEnemyHealthBar();
|
||||
}
|
||||
|
||||
void HUD::resetEnemy()
|
||||
{
|
||||
mEnemy = MWWorld::Ptr();
|
||||
mEnemyHealthTimer = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ namespace MWGui
|
||||
void update();
|
||||
|
||||
void setEnemy(const MWWorld::Ptr& enemy);
|
||||
void resetEnemy();
|
||||
|
||||
private:
|
||||
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth, *mDrowning;
|
||||
|
@ -289,6 +289,10 @@ namespace MWGui
|
||||
|
||||
void WindowManager::setNewGame(bool newgame)
|
||||
{
|
||||
// This method will always be called after loading a savegame or starting a new game
|
||||
// Reset enemy, it could be a dangling pointer from a previous game
|
||||
mHud->resetEnemy();
|
||||
|
||||
if (newgame)
|
||||
{
|
||||
disallowAll();
|
||||
|
Loading…
x
Reference in New Issue
Block a user