Accept a ConstPtr in getToolTipInfo

Accept a ConstPtr in functions used by getToolTipInfo
openmw-38
scrawl 9 years ago
parent d3d6a69eea
commit d9bbd83b09

@ -58,10 +58,9 @@ namespace MWClass
return "";
}
std::string Activator::getName (const MWWorld::Ptr& ptr) const
std::string Activator::getName (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>();
return ref->mBase->mName;
}
@ -89,10 +88,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());

@ -21,14 +21,14 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;

@ -50,10 +50,9 @@ namespace MWClass
return "";
}
std::string Apparatus::getName (const MWWorld::Ptr& ptr) const
std::string Apparatus::getName (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->mName;
}
@ -71,10 +70,9 @@ namespace MWClass
return ref->mBase->mScript;
}
int Apparatus::getValue (const MWWorld::Ptr& ptr) const
int Apparatus::getValue (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.mValue;
}
@ -112,10 +110,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
const MWWorld::LiveCellRef<ESM::Apparatus> *ref = ptr.get<ESM::Apparatus>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());

@ -23,7 +23,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -34,13 +34,13 @@ namespace MWClass
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
static void registerSelf();

@ -56,10 +56,9 @@ namespace MWClass
return "";
}
std::string Armor::getName (const MWWorld::Ptr& ptr) const
std::string Armor::getName (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->mName;
}
@ -75,10 +74,9 @@ namespace MWClass
return true;
}
int Armor::getItemMaxHealth (const MWWorld::Ptr& ptr) const
int Armor::getItemMaxHealth (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.mHealth;
}
@ -92,8 +90,7 @@ namespace MWClass
std::pair<std::vector<int>, bool> Armor::getEquipmentSlots (const MWWorld::Ptr& ptr) const
{
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
std::vector<int> slots_;
@ -124,10 +121,9 @@ namespace MWClass
return std::make_pair (slots_, false);
}
int Armor::getEquipmentSkill (const MWWorld::Ptr& ptr) const
int Armor::getEquipmentSkill (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
std::string typeGmst;
@ -169,10 +165,9 @@ namespace MWClass
return ESM::Skill::HeavyArmor;
}
int Armor::getValue (const MWWorld::Ptr& ptr) const
int Armor::getValue (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.mValue;
}
@ -222,10 +217,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
@ -289,9 +283,9 @@ namespace MWClass
return record->mId;
}
int Armor::getEffectiveArmorRating(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const
int Armor::getEffectiveArmorRating(const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &actor) const
{
MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
int armorSkillType = getEquipmentSkill(ptr);
int armorSkill = actor.getClass().getSkill(actor, armorSkillType);

@ -22,7 +22,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -33,7 +33,7 @@ namespace MWClass
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
///< \return Item health data available?
virtual int getItemMaxHealth (const MWWorld::Ptr& 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
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
@ -43,17 +43,17 @@ namespace MWClass
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
/// stay stacked when equipped?
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr) const;
virtual int getEquipmentSkill (const MWWorld::ConstPtr& ptr) const;
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
/// no such skill.
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
static void registerSelf();
@ -88,7 +88,7 @@ namespace MWClass
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.
virtual int getEffectiveArmorRating(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const;
virtual int getEffectiveArmorRating(const MWWorld::ConstPtr& armor, const MWWorld::Ptr& actor) const;
};
}

@ -53,10 +53,9 @@ namespace MWClass
return "";
}
std::string Book::getName (const MWWorld::Ptr& ptr) const
std::string Book::getName (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->mName;
}
@ -85,10 +84,9 @@ namespace MWClass
return ref->mBase->mScript;
}
int Book::getValue (const MWWorld::Ptr& ptr) const
int Book::getValue (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.mValue;
}
@ -126,10 +124,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -34,10 +34,10 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
static void registerSelf();

@ -52,10 +52,9 @@ namespace MWClass
return "";
}
std::string Clothing::getName (const MWWorld::Ptr& ptr) const
std::string Clothing::getName (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->mName;
}
@ -113,10 +112,9 @@ namespace MWClass
return std::make_pair (slots_, false);
}
int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr) const
int Clothing::getEquipmentSkill (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
if (ref->mBase->mData.mType==ESM::Clothing::Shoes)
return ESM::Skill::Unarmored;
@ -124,10 +122,9 @@ namespace MWClass
return -1;
}
int Clothing::getValue (const MWWorld::Ptr& ptr) const
int Clothing::getValue (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.mValue;
}
@ -179,10 +176,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -35,17 +35,17 @@ namespace MWClass
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
/// stay stacked when equipped?
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr) const;
virtual int getEquipmentSkill (const MWWorld::ConstPtr& ptr) const;
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
/// no such skill.
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
static void registerSelf();

@ -193,10 +193,9 @@ namespace MWClass
}
}
std::string Container::getName (const MWWorld::Ptr& ptr) const
std::string Container::getName (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
return ref->mBase->mName;
}
@ -231,10 +230,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName;

@ -23,7 +23,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -34,7 +34,7 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;

@ -188,10 +188,9 @@ namespace MWClass
return "";
}
std::string Creature::getName (const MWWorld::Ptr& ptr) const
std::string Creature::getName (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
const MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
return ref->mBase->mName;
}
@ -521,10 +520,9 @@ namespace MWClass
return ptr.getRefData().getCustomData()->asCreatureCustomData().mMovement;
}
MWGui::ToolTipInfo Creature::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Creature::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
const MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName;

@ -47,11 +47,11 @@ namespace MWClass
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;

@ -34,7 +34,7 @@ namespace MWClass
return ptr.get<ESM::CreatureLevList>()->mBase->mId;
}
std::string CreatureLevList::getName (const MWWorld::Ptr& ptr) const
std::string CreatureLevList::getName (const MWWorld::ConstPtr& ptr) const
{
return "";
}

@ -14,7 +14,7 @@ namespace MWClass
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.

@ -91,10 +91,9 @@ namespace MWClass
return "";
}
std::string Door::getName (const MWWorld::Ptr& ptr) const
std::string Door::getName (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
return ref->mBase->mName;
}
@ -239,10 +238,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName;

@ -24,7 +24,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -35,7 +35,7 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
static std::string getDestination (const MWWorld::LiveCellRef<ESM::Door>& door);

@ -56,10 +56,9 @@ namespace MWClass
return "";
}
std::string Ingredient::getName (const MWWorld::Ptr& ptr) const
std::string Ingredient::getName (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->mName;
}
@ -77,10 +76,9 @@ namespace MWClass
return ref->mBase->mScript;
}
int Ingredient::getValue (const MWWorld::Ptr& ptr) const
int Ingredient::getValue (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.mValue;
}
@ -128,10 +126,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
const MWWorld::LiveCellRef<ESM::Ingredient> *ref = ptr.get<ESM::Ingredient>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -31,13 +31,13 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)

@ -9,7 +9,7 @@ namespace MWClass
return ptr.get<ESM::ItemLevList>()->mBase->mId;
}
std::string ItemLevList::getName (const MWWorld::Ptr& ptr) const
std::string ItemLevList::getName (const MWWorld::ConstPtr& ptr) const
{
return "";
}

@ -12,7 +12,7 @@ namespace MWClass
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.

@ -72,10 +72,9 @@ namespace MWClass
return "";
}
std::string Light::getName (const MWWorld::Ptr& ptr) const
std::string Light::getName (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
if (ref->mBase->mModel.empty())
return "";
@ -116,10 +115,9 @@ namespace MWClass
return std::make_pair (slots_, false);
}
int Light::getValue (const MWWorld::Ptr& ptr) const
int Light::getValue (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.mValue;
}
@ -158,10 +156,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
@ -201,9 +198,9 @@ namespace MWClass
ptr.getCellRef().setChargeFloat(duration);
}
float Light::getRemainingUsageTime (const MWWorld::Ptr& ptr) const
float Light::getRemainingUsageTime (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
if (ptr.getCellRef().getCharge() == -1)
return static_cast<float>(ref->mBase->mData.mTime);
else

@ -20,14 +20,14 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
@ -41,7 +41,7 @@ namespace MWClass
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
/// stay stacked when equipped?
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
static void registerSelf();
@ -62,7 +62,7 @@ namespace MWClass
virtual void setRemainingUsageTime (const MWWorld::Ptr& ptr, float duration) const;
///< Sets the remaining duration of the object.
virtual float getRemainingUsageTime (const MWWorld::Ptr& ptr) const;
virtual float getRemainingUsageTime (const MWWorld::ConstPtr& ptr) const;
///< Returns the remaining duration of the object.
virtual std::string getModel(const MWWorld::Ptr &ptr) const;

@ -51,10 +51,9 @@ namespace MWClass
return "";
}
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
std::string Lockpick::getName (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->mName;
}
@ -81,10 +80,9 @@ namespace MWClass
return std::make_pair (slots_, false);
}
int Lockpick::getValue (const MWWorld::Ptr& ptr) const
int Lockpick::getValue (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.mValue;
}
@ -122,10 +120,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Lockpick>();
const MWWorld::LiveCellRef<ESM::Lockpick> *ref = ptr.get<ESM::Lockpick>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
@ -173,10 +170,9 @@ namespace MWClass
return (npcServices & ESM::NPC::Picks) != 0;
}
int Lockpick::getItemMaxHealth (const MWWorld::Ptr& ptr) const
int Lockpick::getItemMaxHealth (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.mUses;
}

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -31,7 +31,7 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
@ -41,7 +41,7 @@ namespace MWClass
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
/// stay stacked when equipped?
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
static void registerSelf();
@ -65,7 +65,7 @@ namespace MWClass
virtual float getWeight (const MWWorld::Ptr& ptr) const;
virtual int getItemMaxHealth (const MWWorld::Ptr& 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
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const { return true; }

@ -26,7 +26,7 @@
namespace MWClass
{
bool Miscellaneous::isGold (const MWWorld::Ptr& ptr) const
bool Miscellaneous::isGold (const MWWorld::ConstPtr& ptr) const
{
return Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "gold_001")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "gold_005")
@ -64,10 +64,9 @@ namespace MWClass
return "";
}
std::string Miscellaneous::getName (const MWWorld::Ptr& ptr) const
std::string Miscellaneous::getName (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->mName;
}
@ -85,10 +84,9 @@ namespace MWClass
return ref->mBase->mScript;
}
int Miscellaneous::getValue (const MWWorld::Ptr& ptr) const
int Miscellaneous::getValue (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = ptr.get<ESM::Miscellaneous>();
int value = ref->mBase->mData.mValue;
if (ptr.getCellRef().getGoldValue() > 1 && ptr.getRefData().getCount() == 1)
@ -140,10 +138,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = ptr.get<ESM::Miscellaneous>();
MWGui::ToolTipInfo info;
@ -249,10 +246,9 @@ namespace MWClass
return ref->mBase->mData.mWeight;
}
bool Miscellaneous::isKey(const MWWorld::Ptr &ptr) const
bool Miscellaneous::isKey(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.mIsKey != 0;
}

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -31,13 +31,13 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
static void registerSelf();
@ -61,9 +61,9 @@ namespace MWClass
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
virtual bool isKey (const MWWorld::Ptr &ptr) const;
virtual bool isKey (const MWWorld::ConstPtr &ptr) const;
virtual bool isGold (const MWWorld::Ptr& ptr) const;
virtual bool isGold (const MWWorld::ConstPtr& ptr) const;
};
}

@ -252,6 +252,10 @@ namespace MWClass
{
return *this;
}
virtual const NpcCustomData& asNpcCustomData() const
{
return *this;
}
};
MWWorld::CustomData *NpcCustomData::clone() const
@ -436,9 +440,9 @@ namespace MWClass
}
std::string Npc::getName (const MWWorld::Ptr& ptr) const
std::string Npc::getName (const MWWorld::ConstPtr& ptr) const
{
if(getNpcStats(ptr).isWerewolf())
if(ptr.getRefData().getCustomData() && ptr.getRefData().getCustomData()->asNpcCustomData().mNpcStats.isWerewolf())
{
const MWBase::World *world = MWBase::Environment::get().getWorld();
const MWWorld::Store<ESM::GameSetting> &store = world->getStore().get<ESM::GameSetting>();
@ -446,7 +450,7 @@ namespace MWClass
return store.find("sWerewolfPopup")->getString();
}
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
const MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
return ref->mBase->mName;
}
@ -921,15 +925,15 @@ namespace MWClass
registerClass (typeid (ESM::NPC).name(), instance);
}
MWGui::ToolTipInfo Npc::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Npc::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
const MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
bool fullHelp = MWBase::Environment::get().getWindowManager()->getFullHelp();
MWGui::ToolTipInfo info;
info.caption = getName(ptr);
if(fullHelp && getNpcStats(ptr).isWerewolf())
if(fullHelp && ptr.getRefData().getCustomData() && ptr.getRefData().getCustomData()->asNpcCustomData().mNpcStats.isWerewolf())
{
info.caption += " (";
info.caption += ref->mBase->mName;

@ -51,7 +51,7 @@ namespace MWClass
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -64,7 +64,7 @@ namespace MWClass
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
///< Return container store
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual MWWorld::InventoryStore& getInventoryStore (const MWWorld::Ptr& ptr) const;

@ -54,10 +54,9 @@ namespace MWClass
return "";
}
std::string Potion::getName (const MWWorld::Ptr& ptr) const
std::string Potion::getName (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->mName;
}
@ -76,10 +75,9 @@ namespace MWClass
return ref->mBase->mScript;
}
int Potion::getValue (const MWWorld::Ptr& ptr) const
int Potion::getValue (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.mValue;
}
@ -117,10 +115,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
const MWWorld::LiveCellRef<ESM::Potion> *ref = ptr.get<ESM::Potion>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -31,13 +31,13 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;

@ -51,10 +51,9 @@ namespace MWClass
return "";
}
std::string Probe::getName (const MWWorld::Ptr& ptr) const
std::string Probe::getName (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->mName;
}
@ -81,10 +80,9 @@ namespace MWClass
return std::make_pair (slots_, false);
}
int Probe::getValue (const MWWorld::Ptr& ptr) const
int Probe::getValue (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.mValue;
}
@ -122,10 +120,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
const MWWorld::LiveCellRef<ESM::Probe> *ref = ptr.get<ESM::Probe>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
@ -173,10 +170,9 @@ namespace MWClass
return (npcServices & ESM::NPC::Probes) != 0;
}
int Probe::getItemMaxHealth (const MWWorld::Ptr& ptr) const
int Probe::getItemMaxHealth (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.mUses;
}

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -31,7 +31,7 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
@ -41,7 +41,7 @@ namespace MWClass
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
/// stay stacked when equipped?
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
static void registerSelf();
@ -65,7 +65,7 @@ namespace MWClass
virtual float getWeight (const MWWorld::Ptr& ptr) const;
virtual int getItemMaxHealth (const MWWorld::Ptr& 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
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const { return true; }

@ -50,10 +50,9 @@ namespace MWClass
return "";
}
std::string Repair::getName (const MWWorld::Ptr& ptr) const
std::string Repair::getName (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->mName;
}
@ -72,10 +71,9 @@ namespace MWClass
return ref->mBase->mScript;
}
int Repair::getValue (const MWWorld::Ptr& ptr) const
int Repair::getValue (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.mValue;
}
@ -118,18 +116,16 @@ namespace MWClass
return true;
}
int Repair::getItemMaxHealth (const MWWorld::Ptr& ptr) const
int Repair::getItemMaxHealth (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.mUses;
}
MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
const MWWorld::LiveCellRef<ESM::Repair> *ref = ptr.get<ESM::Repair>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -31,13 +31,13 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
static void registerSelf();
@ -61,7 +61,7 @@ namespace MWClass
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
///< \return Item health data available? (default implementation: false)
virtual int getItemMaxHealth (const MWWorld::Ptr& 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
/// (default implementation: throw an exception)

@ -42,7 +42,7 @@ namespace MWClass
return "";
}
std::string Static::getName (const MWWorld::Ptr& ptr) const
std::string Static::getName (const MWWorld::ConstPtr& ptr) const
{
return "";
}

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.

@ -54,10 +54,9 @@ namespace MWClass
return "";
}
std::string Weapon::getName (const MWWorld::Ptr& ptr) const
std::string Weapon::getName (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->mName;
}
@ -76,10 +75,9 @@ namespace MWClass
return (ref->mBase->mData.mType < 11); // thrown weapons and arrows/bolts don't have health, only quantity
}
int Weapon::getItemMaxHealth (const MWWorld::Ptr& ptr) const
int Weapon::getItemMaxHealth (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.mHealth;
}
@ -116,10 +114,9 @@ namespace MWClass
return std::make_pair (slots_, stack);
}
int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr) const
int Weapon::getEquipmentSkill (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
const int size = 12;
@ -146,10 +143,9 @@ namespace MWClass
return -1;
}
int Weapon::getValue (const MWWorld::Ptr& ptr) const
int Weapon::getValue (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.mValue;
}
@ -267,10 +263,9 @@ namespace MWClass
return (ref->mBase->mName != "");
}
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::Ptr& ptr) const
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::ConstPtr& ptr) const
{
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
MWGui::ToolTipInfo info;
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());

@ -20,7 +20,7 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual std::string getName (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -31,13 +31,13 @@ namespace MWClass
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
///< \return Item health data available?
virtual int getItemMaxHealth (const MWWorld::Ptr& 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
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
@ -47,11 +47,11 @@ namespace MWClass
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
/// stay stacked when equipped?
virtual int getEquipmentSkill (const MWWorld::Ptr& ptr) const;
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
virtual int getEquipmentSkill (const MWWorld::ConstPtr& ptr) const;
/// Return the index of the skill this item corresponds to when equipped or -1, if there is
/// no such skill.
virtual int getValue (const MWWorld::Ptr& ptr) const;
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
static void registerSelf();

@ -80,7 +80,7 @@ namespace MWWorld
return false;
}
int Class::getItemHealth(const Ptr &ptr) const
int Class::getItemHealth(const ConstPtr &ptr) const
{
if (ptr.getCellRef().getCharge() == -1)
return getItemMaxHealth(ptr);
@ -88,7 +88,7 @@ namespace MWWorld
return ptr.getCellRef().getCharge();
}
int Class::getItemMaxHealth (const Ptr& ptr) const
int Class::getItemMaxHealth (const ConstPtr& ptr) const
{
throw std::runtime_error ("class does not have item health");
}
@ -153,7 +153,7 @@ namespace MWWorld
throw std::runtime_error ("class does not support time-based uses");
}
float Class::getRemainingUsageTime (const Ptr& ptr) const
float Class::getRemainingUsageTime (const ConstPtr& ptr) const
{
return -1;
}
@ -193,12 +193,12 @@ namespace MWWorld
return std::make_pair (std::vector<int>(), false);
}
int Class::getEquipmentSkill (const Ptr& ptr) const
int Class::getEquipmentSkill (const ConstPtr& ptr) const
{
return -1;
}
int Class::getValue (const Ptr& ptr) const
int Class::getValue (const ConstPtr& ptr) const
{
throw std::logic_error ("value not supported by this class");
}
@ -272,7 +272,7 @@ namespace MWWorld
throw std::runtime_error ("class does not have any inventory icon");
}
MWGui::ToolTipInfo Class::getToolTipInfo (const Ptr& ptr) const
MWGui::ToolTipInfo Class::getToolTipInfo (const ConstPtr& ptr) const
{
throw std::runtime_error ("class does not have a tool tip");
}
@ -447,7 +447,7 @@ namespace MWWorld
return -1;
}
int Class::getEffectiveArmorRating(const Ptr &ptr, const Ptr &actor) const
int Class::getEffectiveArmorRating(const ConstPtr &armor, const Ptr &actor) const
{
throw std::runtime_error("class does not support armor ratings");
}

@ -86,7 +86,7 @@ namespace MWWorld
virtual void insertObject(const Ptr& ptr, const std::string& mesh, MWPhysics::PhysicsSystem& physics) const;
///< Add reference into a cell for rendering (default implementation: don't render anything).
virtual std::string getName (const Ptr& ptr) const = 0;
virtual std::string getName (const ConstPtr& ptr) const = 0;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
@ -101,7 +101,7 @@ namespace MWWorld
virtual bool hasToolTip (const Ptr& ptr) const;
///< @return true if this object has a tooltip when focused (default implementation: false)
virtual MWGui::ToolTipInfo getToolTipInfo (const Ptr& ptr) const;
virtual MWGui::ToolTipInfo getToolTipInfo (const ConstPtr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual MWMechanics::NpcStats& getNpcStats (const Ptr& ptr) const;
@ -111,10 +111,10 @@ namespace MWWorld
virtual bool hasItemHealth (const Ptr& ptr) const;
///< \return Item health data available? (default implementation: false)
virtual int getItemHealth (const Ptr& ptr) const;
virtual int getItemHealth (const ConstPtr& ptr) const;
///< Return current item health or throw an exception if class does not have item health
virtual int getItemMaxHealth (const Ptr& ptr) const;
virtual int getItemMaxHealth (const ConstPtr& ptr) const;
///< Return item max health or throw an exception, if class does not have item health
/// (default implementation: throw an exception)
@ -167,7 +167,7 @@ namespace MWWorld
///< Sets the remaining duration of the object, such as an equippable light
/// source. (default implementation: throw an exception)
virtual float getRemainingUsageTime (const Ptr& ptr) const;
virtual float getRemainingUsageTime (const ConstPtr& ptr) const;
///< Returns the remaining duration of the object, such as an equippable light
/// source. (default implementation: -1, i.e. infinite)
@ -193,13 +193,13 @@ namespace MWWorld
///
/// Default implementation: return (empty vector, false).
virtual int getEquipmentSkill (const Ptr& ptr)
virtual int getEquipmentSkill (const ConstPtr& ptr)
const;
/// Return the index of the skill this item corresponds to when equiopped or -1, if there is
/// no such skill.
/// (default implementation: return -1)
virtual int getValue (const Ptr& ptr) const;
virtual int getValue (const ConstPtr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded.
/// (default implementation: throws an exception)
@ -279,9 +279,9 @@ namespace MWWorld
virtual bool isPersistent (const MWWorld::Ptr& ptr) const;
virtual bool isKey (const MWWorld::Ptr& ptr) const { return false; }
virtual bool isKey (const MWWorld::ConstPtr& ptr) const { return false; }
virtual bool isGold(const MWWorld::Ptr& 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)
virtual int getBloodTexture (const MWWorld::Ptr& ptr) const;
@ -344,7 +344,7 @@ namespace MWWorld
virtual int getPrimaryFactionRank (const MWWorld::Ptr& ptr) const;
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.
virtual int getEffectiveArmorRating(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const;
virtual int getEffectiveArmorRating(const MWWorld::ConstPtr& armor, const MWWorld::Ptr& actor) const;
};
}

@ -21,6 +21,13 @@ MWClass::NpcCustomData &CustomData::asNpcCustomData()
throw std::logic_error(error.str());
}
const MWClass::NpcCustomData &CustomData::asNpcCustomData() const
{
std::stringstream error;
error << "bad cast " << typeid(this).name() << " to NpcCustomData";
throw std::logic_error(error.str());
}
MWClass::ContainerCustomData &CustomData::asContainerCustomData()
{
std::stringstream error;

@ -26,6 +26,7 @@ namespace MWWorld
virtual MWClass::CreatureCustomData& asCreatureCustomData();
virtual MWClass::NpcCustomData& asNpcCustomData();
virtual const MWClass::NpcCustomData& asNpcCustomData() const;
virtual MWClass::ContainerCustomData& asContainerCustomData();

Loading…
Cancel
Save