Accept a ConstPtr in applyEnchantment

openmw-38
scrawl 9 years ago
parent 3c98f8dde3
commit 648ee6e7fb

@ -265,10 +265,9 @@ namespace MWClass
return ref->mBase->mEnchant; return ref->mBase->mEnchant;
} }
std::string Armor::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const std::string Armor::applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
{ {
MWWorld::LiveCellRef<ESM::Armor> *ref = const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
ptr.get<ESM::Armor>();
ESM::Armor newItem = *ref->mBase; ESM::Armor newItem = *ref->mBase;
newItem.mId=""; newItem.mId="";

@ -69,7 +69,7 @@ namespace MWClass
virtual std::string getEnchantment (const MWWorld::ConstPtr& ptr) const; virtual std::string getEnchantment (const MWWorld::ConstPtr& ptr) const;
///< @return the enchantment ID if the object is enchanted, otherwise an empty string ///< @return the enchantment ID if the object is enchanted, otherwise an empty string
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const; virtual std::string applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it. ///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
virtual std::pair<int, std::string> canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const; virtual std::pair<int, std::string> canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const;

@ -153,10 +153,9 @@ namespace MWClass
return ref->mBase->mEnchant; return ref->mBase->mEnchant;
} }
std::string Book::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const std::string Book::applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
{ {
MWWorld::LiveCellRef<ESM::Book> *ref = const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>();
ptr.get<ESM::Book>();
ESM::Book newItem = *ref->mBase; ESM::Book newItem = *ref->mBase;
newItem.mId=""; newItem.mId="";

@ -53,7 +53,7 @@ namespace MWClass
virtual std::string getEnchantment (const MWWorld::ConstPtr& ptr) const; virtual std::string getEnchantment (const MWWorld::ConstPtr& ptr) const;
///< @return the enchantment ID if the object is enchanted, otherwise an empty string ///< @return the enchantment ID if the object is enchanted, otherwise an empty string
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const; virtual std::string applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it. ///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const; virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;

@ -204,10 +204,9 @@ namespace MWClass
return ref->mBase->mEnchant; return ref->mBase->mEnchant;
} }
std::string Clothing::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const std::string Clothing::applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
{ {
MWWorld::LiveCellRef<ESM::Clothing> *ref = const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
ptr.get<ESM::Clothing>();
ESM::Clothing newItem = *ref->mBase; ESM::Clothing newItem = *ref->mBase;
newItem.mId=""; newItem.mId="";

@ -61,7 +61,7 @@ namespace MWClass
virtual std::string getEnchantment (const MWWorld::ConstPtr& ptr) const; virtual std::string getEnchantment (const MWWorld::ConstPtr& ptr) const;
///< @return the enchantment ID if the object is enchanted, otherwise an empty string ///< @return the enchantment ID if the object is enchanted, otherwise an empty string
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const; virtual std::string applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it. ///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
virtual std::pair<int, std::string> canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const; virtual std::pair<int, std::string> canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const;

@ -350,10 +350,9 @@ namespace MWClass
return ref->mBase->mEnchant; return ref->mBase->mEnchant;
} }
std::string Weapon::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const std::string Weapon::applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
{ {
MWWorld::LiveCellRef<ESM::Weapon> *ref = const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
ptr.get<ESM::Weapon>();
ESM::Weapon newItem = *ref->mBase; ESM::Weapon newItem = *ref->mBase;
newItem.mId=""; newItem.mId="";

@ -68,7 +68,7 @@ namespace MWClass
virtual std::string getEnchantment (const MWWorld::ConstPtr& ptr) const; virtual std::string getEnchantment (const MWWorld::ConstPtr& ptr) const;
///< @return the enchantment ID if the object is enchanted, otherwise an empty string ///< @return the enchantment ID if the object is enchanted, otherwise an empty string
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const; virtual std::string applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it. ///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
virtual std::pair<int, std::string> canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const; virtual std::pair<int, std::string> canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const;

@ -296,7 +296,7 @@ namespace MWWorld
return ""; return "";
} }
std::string Class::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const std::string Class::applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
{ {
throw std::runtime_error ("class can't be enchanted"); throw std::runtime_error ("class can't be enchanted");
} }

@ -268,7 +268,7 @@ namespace MWWorld
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const; virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const; virtual std::string applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const;
///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it. ///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
virtual std::pair<int, std::string> canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const; virtual std::pair<int, std::string> canBeEquipped(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const;
@ -281,7 +281,7 @@ namespace MWWorld
virtual bool isKey (const MWWorld::ConstPtr& ptr) const { return false; } virtual bool isKey (const MWWorld::ConstPtr& ptr) const { return false; }
virtual bool isGold(const MWWorld::ConstPtr& ptr) const { return false; }; virtual bool isGold(const MWWorld::ConstPtr& ptr) const { return false; }
/// Get a blood texture suitable for \a ptr (see Blood Texture 0-2 in Morrowind.ini) /// Get a blood texture suitable for \a ptr (see Blood Texture 0-2 in Morrowind.ini)
virtual int getBloodTexture (const MWWorld::ConstPtr& ptr) const; virtual int getBloodTexture (const MWWorld::ConstPtr& ptr) const;

Loading…
Cancel
Save