Accept a ConstPtr in getEnchantmentPoints

This commit is contained in:
scrawl 2015-12-18 16:48:19 +01:00
parent 303521002d
commit c43f80633a
10 changed files with 14 additions and 18 deletions

View file

@ -371,10 +371,9 @@ namespace MWClass
return MWWorld::Ptr(cell.insert(ref), &cell);
}
int Armor::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
int Armor::getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
return ref->mBase->mData.mEnchant;
}

View file

@ -82,7 +82,7 @@ namespace MWClass
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
virtual int getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const;
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;

View file

@ -179,10 +179,9 @@ namespace MWClass
return MWWorld::Ptr(cell.insert(ref), &cell);
}
int Book::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
int Book::getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>();
return ref->mBase->mData.mEnchant;
}

View file

@ -61,7 +61,7 @@ namespace MWClass
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
virtual int getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const;
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;

View file

@ -264,10 +264,9 @@ namespace MWClass
return MWWorld::Ptr(cell.insert(ref), &cell);
}
int Clothing::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
int Clothing::getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
return ref->mBase->mData.mEnchant;
}

View file

@ -74,7 +74,7 @@ namespace MWClass
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
virtual int getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const;
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;

View file

@ -405,10 +405,9 @@ namespace MWClass
return MWWorld::Ptr(cell.insert(ref), &cell);
}
int Weapon::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
int Weapon::getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
return ref->mBase->mData.mEnchant;
}

View file

@ -85,7 +85,7 @@ namespace MWClass
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
virtual int getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const;
};
}

View file

@ -173,7 +173,7 @@ namespace MWWorld
return 0;
}
int Class::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
int Class::getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const
{
throw std::runtime_error ("class does not support enchanting");
}

View file

@ -255,7 +255,7 @@ namespace MWWorld
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
/// (default implementation: return empty string)
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
virtual int getEnchantmentPoints (const MWWorld::ConstPtr& ptr) const;
///< @return the number of enchantment points available for possible enchanting
virtual void adjustScale(const MWWorld::ConstPtr& ptr, osg::Vec3f& scale, bool rendering) const;