diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index 98bfa59c89..b18bca98d5 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -20,31 +20,6 @@ namespace MWMechanics int CreatureStats::sActorId = 0; CreatureStats::CreatureStats() - : mDrawState(DrawState::Nothing) - , mDead(false) - , mDeathAnimationFinished(false) - , mDied(false) - , mMurdered(false) - , mFriendlyHits(0) - , mTalkedTo(false) - , mAlarmed(false) - , mAttacked(false) - , mKnockdown(false) - , mKnockdownOneFrame(false) - , mKnockdownOverOneFrame(false) - , mHitRecovery(false) - , mBlock(false) - , mMovementFlags(0) - , mFallHeight(0) - , mLastRestock(0, 0) - , mGoldPool(0) - , mActorId(-1) - , mHitAttemptActorId(-1) - , mDeathAnimation(-1) - , mTimeOfDeath() - , mSideMovementAngle(0) - , mLevel(0) - , mAttackingOrSpell(false) { for (const ESM::Attribute& attribute : MWBase::Environment::get().getESMStore()->get()) { diff --git a/apps/openmw/mwmechanics/creaturestats.hpp b/apps/openmw/mwmechanics/creaturestats.hpp index 3f7c57094c..f65e1a000f 100644 --- a/apps/openmw/mwmechanics/creaturestats.hpp +++ b/apps/openmw/mwmechanics/creaturestats.hpp @@ -39,30 +39,30 @@ namespace MWMechanics class CreatureStats { static int sActorId; - DrawState mDrawState; std::map mAttributes; DynamicStat mDynamic[3]; // health, magicka, fatigue + DrawState mDrawState = DrawState::Nothing; Spells mSpells; ActiveSpells mActiveSpells; MagicEffects mMagicEffects; Stat mAiSettings[4]; AiSequence mAiSequence; - bool mDead; - bool mDeathAnimationFinished; - bool mDied; // flag for OnDeath script function - bool mMurdered; - int mFriendlyHits; - bool mTalkedTo; - bool mAlarmed; - bool mAttacked; - bool mKnockdown; - bool mKnockdownOneFrame; - bool mKnockdownOverOneFrame; - bool mHitRecovery; - bool mBlock; - unsigned int mMovementFlags; - - float mFallHeight; + bool mDead = false; + bool mDeathAnimationFinished = false; + bool mDied = false; // flag for OnDeath script function + bool mMurdered = false; + int mFriendlyHits = 0; + bool mTalkedTo = false; + bool mAlarmed = false; + bool mAttacked = false; + bool mKnockdown = false; + bool mKnockdownOneFrame = false; + bool mKnockdownOverOneFrame = false; + bool mHitRecovery = false; + bool mBlock = false; + unsigned int mMovementFlags = 0; + + float mFallHeight = 0.f; ESM::RefId mLastHitObject; // The last object to hit this actor ESM::RefId mLastHitAttemptObject; // The last object to attempt to hit this actor @@ -71,21 +71,17 @@ namespace MWMechanics MWWorld::TimeStamp mLastRestock; // The pool of merchant gold (not in inventory) - int mGoldPool; + int mGoldPool = 0; - int mActorId; - int mHitAttemptActorId; // Stores an actor that attacked this actor. Only one is stored at a time, - // and it is not changed if a different actor attacks. It is cleared when combat ends. - - // The index of the death animation that was played, or -1 if none played - signed char mDeathAnimation; - - MWWorld::TimeStamp mTimeOfDeath; + int mActorId = -1; + // Stores an actor that attacked this actor. Only one is stored at a time, and it is not changed if a different + // actor attacks. It is cleared when combat ends. + int mHitAttemptActorId = -1; // The difference between view direction and lower body direction. - float mSideMovementAngle; + float mSideMovementAngle = 0; - bool mTeleported = false; + MWWorld::TimeStamp mTimeOfDeath; private: std::multimap mSummonedCreatures; // @@ -95,9 +91,15 @@ namespace MWMechanics std::vector mSummonGraveyard; protected: - int mLevel; - bool mAttackingOrSpell; std::string mAttackType; + int mLevel = 0; + bool mAttackingOrSpell = false; + + private: + // The index of the death animation that was played, or -1 if none played + signed char mDeathAnimation = -1; + + bool mTeleported = false; public: CreatureStats();