Initialize variable without reading itself

pull/2819/head
elsid 5 years ago
parent eeb13ad8a3
commit 6d8debe009
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -266,16 +266,22 @@ void HeadAnimationTime::setBlinkStop(float value)
// ----------------------------------------------------
NpcAnimation::NpcType NpcAnimation::getNpcType()
NpcAnimation::NpcType NpcAnimation::getNpcType() const
{
const MWWorld::Class &cls = mPtr.getClass();
// Dead vampires should typically stay vampires.
if (mNpcType == Type_Vampire && cls.getNpcStats(mPtr).isDead() && !cls.getNpcStats(mPtr).isWerewolf())
return mNpcType;
return getNpcType(mPtr);
}
NpcAnimation::NpcType NpcAnimation::getNpcType(const MWWorld::Ptr& ptr)
{
const MWWorld::Class &cls = ptr.getClass();
NpcAnimation::NpcType curType = Type_Normal;
if (cls.getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Vampirism).getMagnitude() > 0)
if (cls.getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Vampirism).getMagnitude() > 0)
curType = Type_Vampire;
if (cls.getNpcStats(mPtr).isWerewolf())
if (cls.getNpcStats(ptr).isWerewolf())
curType = Type_Werewolf;
return curType;
@ -326,7 +332,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> par
mViewMode(viewMode),
mShowWeapons(false),
mShowCarriedLeft(true),
mNpcType(getNpcType()),
mNpcType(getNpcType(ptr)),
mFirstPersonFieldOfView(firstPersonFieldOfView),
mSoundsDisabled(disableSounds),
mAccurateAiming(false),

@ -74,7 +74,7 @@ private:
void updateNpcBase();
NpcType getNpcType();
NpcType getNpcType() const;
PartHolderPtr insertBoundedPart(const std::string &model, const std::string &bonename,
const std::string &bonefilter, bool enchantedGlow, osg::Vec4f* glowColor=nullptr);
@ -94,6 +94,7 @@ private:
static bool isFirstPersonPart(const ESM::BodyPart* bodypart);
static bool isFemalePart(const ESM::BodyPart* bodypart);
static NpcType getNpcType(const MWWorld::Ptr& ptr);
protected:
virtual void addControllers();

Loading…
Cancel
Save