Accept a ConstPtr in isEssential

openmw-38
scrawl 9 years ago
parent 4a47fc32fa
commit 3fe3091275

@ -448,7 +448,7 @@ namespace MWClass
return ref->mBase->mScript; return ref->mBase->mScript;
} }
bool Creature::isEssential (const MWWorld::Ptr& ptr) const bool Creature::isEssential (const MWWorld::ConstPtr& ptr) const
{ {
return isFlagBitSet(ptr, ESM::Creature::Essential); return isFlagBitSet(ptr, ESM::Creature::Essential);
} }

@ -83,7 +83,7 @@ namespace MWClass
virtual float getArmorRating (const MWWorld::Ptr& ptr) const; virtual float getArmorRating (const MWWorld::Ptr& ptr) const;
///< @return combined armor rating of this actor ///< @return combined armor rating of this actor
virtual bool isEssential (const MWWorld::Ptr& ptr) const; virtual bool isEssential (const MWWorld::ConstPtr& ptr) const;
///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable) ///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable)
virtual int getServices (const MWWorld::Ptr& actor) const; virtual int getServices (const MWWorld::Ptr& actor) const;

@ -908,10 +908,9 @@ namespace MWClass
return ptr.getRefData().getCustomData()->asNpcCustomData().mMovement; return ptr.getRefData().getCustomData()->asNpcCustomData().mMovement;
} }
bool Npc::isEssential (const MWWorld::Ptr& ptr) const bool Npc::isEssential (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::NPC> *ref = const MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
ptr.get<ESM::NPC>();
return (ref->mBase->mFlags & ESM::NPC::Essential) != 0; return (ref->mBase->mFlags & ESM::NPC::Essential) != 0;
} }

@ -114,7 +114,7 @@ namespace MWClass
virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType, float extraFactor=1.f) const; virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType, float extraFactor=1.f) const;
///< Inform actor \a ptr that a skill use has succeeded. ///< Inform actor \a ptr that a skill use has succeeded.
virtual bool isEssential (const MWWorld::Ptr& ptr) const; virtual bool isEssential (const MWWorld::ConstPtr& ptr) const;
///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable) ///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable)
virtual int getServices (const MWWorld::Ptr& actor) const; virtual int getServices (const MWWorld::Ptr& actor) const;

@ -218,7 +218,7 @@ namespace MWWorld
throw std::runtime_error ("encumbrance not supported by class"); throw std::runtime_error ("encumbrance not supported by class");
} }
bool Class::isEssential (const MWWorld::Ptr& ptr) const bool Class::isEssential (const MWWorld::ConstPtr& ptr) const
{ {
return false; return false;
} }

@ -229,7 +229,7 @@ namespace MWWorld
/// ///
/// (default implementations: throws an exception) /// (default implementations: throws an exception)
virtual bool isEssential (const MWWorld::Ptr& ptr) const; virtual bool isEssential (const MWWorld::ConstPtr& ptr) const;
///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable) ///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable)
/// ///
/// (default implementation: return false) /// (default implementation: return false)

Loading…
Cancel
Save