Accept a ConstPtr in getPrimaryFaction, getPrimaryFactionRank

openmw-38
scrawl 9 years ago
parent 2ac92012e8
commit 2bd8d60e9f

@ -1255,15 +1255,15 @@ namespace MWClass
return true;
}
std::string Npc::getPrimaryFaction (const MWWorld::Ptr& ptr) const
std::string Npc::getPrimaryFaction (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
const MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
return ref->mBase->mFaction;
}
int Npc::getPrimaryFactionRank (const MWWorld::Ptr& ptr) const
int Npc::getPrimaryFactionRank (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
const MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
return ref->mBase->getFactionRank();
}
}

@ -164,8 +164,8 @@ namespace MWClass
virtual int getBaseFightRating (const MWWorld::ConstPtr& ptr) const;
virtual std::string getPrimaryFaction(const MWWorld::Ptr &ptr) const;
virtual int getPrimaryFactionRank(const MWWorld::Ptr &ptr) const;
virtual std::string getPrimaryFaction(const MWWorld::ConstPtr &ptr) const;
virtual int getPrimaryFactionRank(const MWWorld::ConstPtr &ptr) const;
};
}

@ -32,7 +32,7 @@
namespace
{
std::string getDialogueActorFaction(MWWorld::Ptr actor)
std::string getDialogueActorFaction(MWWorld::ConstPtr actor)
{
std::string factionId = actor.getClass().getPrimaryFaction(actor);
if (factionId.empty())
@ -530,7 +530,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr actor = R()(runtime, false);
MWWorld::ConstPtr actor = R()(runtime, false);
std::string factionID = "";
@ -562,7 +562,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr actor = R()(runtime, false);
MWWorld::ConstPtr actor = R()(runtime, false);
std::string factionID = "";
@ -601,7 +601,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr actor = R()(runtime, false);
MWWorld::ConstPtr actor = R()(runtime, false);
std::string factionID = "";
@ -633,7 +633,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
MWWorld::ConstPtr ptr = R()(runtime, false);
std::string factionID = "";
if(arg0 >0)
@ -739,7 +739,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
MWWorld::ConstPtr ptr = R()(runtime, false);
std::string factionId;
@ -771,7 +771,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
MWWorld::ConstPtr ptr = R()(runtime, false);
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
@ -805,7 +805,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
MWWorld::ConstPtr ptr = R()(runtime, false);
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
@ -867,7 +867,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
MWWorld::ConstPtr ptr = R()(runtime);
std::string race = runtime.getStringLiteral(runtime[0].mInteger);
::Misc::StringUtils::lowerCaseInPlace(race);
@ -899,7 +899,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
MWWorld::ConstPtr ptr = R()(runtime, false);
std::string factionID = "";
if(arg0 >0 )
@ -931,7 +931,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
MWWorld::ConstPtr ptr = R()(runtime, false);
std::string factionID = "";
if(arg0 >0 )
@ -958,7 +958,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
MWWorld::ConstPtr ptr = R()(runtime, false);
std::string factionID = "";
if(arg0 >0 )

@ -438,11 +438,11 @@ namespace MWWorld
throw std::runtime_error("class does not support fight rating");
}
std::string Class::getPrimaryFaction (const MWWorld::Ptr& ptr) const
std::string Class::getPrimaryFaction (const MWWorld::ConstPtr& ptr) const
{
return std::string();
}
int Class::getPrimaryFactionRank (const MWWorld::Ptr& ptr) const
int Class::getPrimaryFactionRank (const MWWorld::ConstPtr& ptr) const
{
return -1;
}

@ -338,8 +338,8 @@ namespace MWWorld
virtual int getBaseFightRating (const MWWorld::ConstPtr& ptr) const;
virtual std::string getPrimaryFaction (const MWWorld::Ptr& ptr) const;
virtual int getPrimaryFactionRank (const MWWorld::Ptr& ptr) const;
virtual std::string getPrimaryFaction (const MWWorld::ConstPtr& ptr) const;
virtual int getPrimaryFactionRank (const MWWorld::ConstPtr& ptr) const;
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.
virtual int getEffectiveArmorRating(const MWWorld::ConstPtr& armor, const MWWorld::Ptr& actor) const;

Loading…
Cancel
Save