mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:23:54 +00:00
Accept a ConstPtr in getWeight
This commit is contained in:
parent
0047a2d330
commit
e0bb284804
26 changed files with 38 additions and 50 deletions
|
@ -149,10 +149,9 @@ namespace MWClass
|
|||
return (npcServices & ESM::NPC::Apparatus) != 0;
|
||||
}
|
||||
|
||||
float Apparatus::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Apparatus::getWeight(const MWWorld::ConstPtr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
const MWWorld::LiveCellRef<ESM::Apparatus> *ref = ptr.get<ESM::Apparatus>();
|
||||
return ref->mBase->mData.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
|
|
@ -388,10 +388,9 @@ namespace MWClass
|
|||
|| ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
|
||||
}
|
||||
|
||||
float Armor::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Armor::getWeight(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.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
|
|
@ -196,10 +196,9 @@ namespace MWClass
|
|||
|| ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
|
||||
}
|
||||
|
||||
float Book::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Book::getWeight(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.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace MWClass
|
|||
|
||||
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
};
|
||||
|
|
|
@ -284,10 +284,9 @@ namespace MWClass
|
|||
|| ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
|
||||
}
|
||||
|
||||
float Clothing::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Clothing::getWeight(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.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace MWClass
|
|||
|
||||
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
};
|
||||
|
|
|
@ -187,10 +187,9 @@ namespace MWClass
|
|||
}
|
||||
|
||||
|
||||
float Ingredient::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Ingredient::getWeight(const MWWorld::ConstPtr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
const MWWorld::LiveCellRef<ESM::Ingredient> *ref = ptr.get<ESM::Ingredient>();
|
||||
return ref->mBase->mData.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace MWClass
|
|||
|
||||
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
};
|
||||
|
|
|
@ -218,10 +218,9 @@ namespace MWClass
|
|||
return (npcServices & ESM::NPC::Lights) != 0;
|
||||
}
|
||||
|
||||
float Light::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Light::getWeight(const MWWorld::ConstPtr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
|
||||
return ref->mBase->mData.mWeight;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace MWClass
|
|||
|
||||
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
|
||||
|
|
|
@ -174,10 +174,9 @@ namespace MWClass
|
|||
return ref->mBase->mData.mUses;
|
||||
}
|
||||
|
||||
float Lockpick::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Lockpick::getWeight(const MWWorld::ConstPtr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Lockpick> *ref =
|
||||
ptr.get<ESM::Lockpick>();
|
||||
const MWWorld::LiveCellRef<ESM::Lockpick> *ref = ptr.get<ESM::Lockpick>();
|
||||
return ref->mBase->mData.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace MWClass
|
|||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual int getItemMaxHealth (const MWWorld::ConstPtr& ptr) const;
|
||||
///< Return item max health or throw an exception, if class does not have item health
|
||||
|
|
|
@ -235,10 +235,9 @@ namespace MWClass
|
|||
return !ref->mBase->mData.mIsKey && (npcServices & ESM::NPC::Misc) && !isGold(item);
|
||||
}
|
||||
|
||||
float Miscellaneous::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Miscellaneous::getWeight(const MWWorld::ConstPtr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = ptr.get<ESM::Miscellaneous>();
|
||||
return ref->mBase->mData.mWeight;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace MWClass
|
|||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
|
||||
|
|
|
@ -180,10 +180,9 @@ namespace MWClass
|
|||
return (npcServices & ESM::NPC::Potions) != 0;
|
||||
}
|
||||
|
||||
float Potion::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Potion::getWeight(const MWWorld::ConstPtr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
const MWWorld::LiveCellRef<ESM::Potion> *ref = ptr.get<ESM::Potion>();
|
||||
return ref->mBase->mData.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace MWClass
|
|||
|
||||
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
};
|
||||
|
|
|
@ -174,10 +174,9 @@ namespace MWClass
|
|||
return ref->mBase->mData.mUses;
|
||||
}
|
||||
|
||||
float Probe::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Probe::getWeight(const MWWorld::ConstPtr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
const MWWorld::LiveCellRef<ESM::Probe> *ref = ptr.get<ESM::Probe>();
|
||||
return ref->mBase->mData.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace MWClass
|
|||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual int getItemMaxHealth (const MWWorld::ConstPtr& ptr) const;
|
||||
///< Return item max health or throw an exception, if class does not have item health
|
||||
|
|
|
@ -166,10 +166,9 @@ namespace MWClass
|
|||
return (npcServices & ESM::NPC::RepairItem) != 0;
|
||||
}
|
||||
|
||||
float Repair::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Repair::getWeight(const MWWorld::ConstPtr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
const MWWorld::LiveCellRef<ESM::Repair> *ref = ptr.get<ESM::Repair>();
|
||||
return ref->mBase->mData.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace MWClass
|
|||
///< Return item max health or throw an exception, if class does not have item health
|
||||
/// (default implementation: throw an exception)
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
};
|
||||
|
|
|
@ -425,10 +425,9 @@ namespace MWClass
|
|||
|| ((npcServices & ESM::NPC::MagicItems) && !getEnchantment(item).empty());
|
||||
}
|
||||
|
||||
float Weapon::getWeight(const MWWorld::Ptr &ptr) const
|
||||
float Weapon::getWeight(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.mWeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace MWClass
|
|||
|
||||
virtual bool canSell (const MWWorld::ConstPtr& item, int npcServices) const;
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual int getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||
};
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace MWWorld
|
|||
throw std::runtime_error ("capacity not supported by this class");
|
||||
}
|
||||
|
||||
float Class::getWeight(const Ptr &ptr) const
|
||||
float Class::getWeight(const ConstPtr &ptr) const
|
||||
{
|
||||
throw std::runtime_error ("weight not supported by this class");
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace MWWorld
|
|||
///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that.
|
||||
/// Second item in the pair specifies the error message
|
||||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
|
||||
|
||||
virtual bool isPersistent (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue