1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-01 00:32:52 +00:00

Accept a ConstPtr in getScript

This commit is contained in:
scrawl 2015-12-18 00:12:03 +01:00
parent eb51e2838f
commit b48445dea7
36 changed files with 53 additions and 64 deletions

View File

@ -66,9 +66,9 @@ namespace MWClass
return ref->mBase->mName; return ref->mBase->mName;
} }
std::string Activator::getScript (const MWWorld::Ptr& ptr) const std::string Activator::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Activator> *ref = const MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>(); ptr.get<ESM::Activator>();
return ref->mBase->mScript; return ref->mBase->mScript;

View File

@ -31,7 +31,7 @@ namespace MWClass
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const; virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip. ///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const;

View File

@ -64,10 +64,9 @@ namespace MWClass
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
std::string Apparatus::getScript (const MWWorld::Ptr& ptr) const std::string Apparatus::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Apparatus> *ref = const MWWorld::LiveCellRef<ESM::Apparatus> *ref = ptr.get<ESM::Apparatus>();
ptr.get<ESM::Apparatus>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -31,7 +31,7 @@ namespace MWClass
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const; virtual int getValue (const MWWorld::Ptr& ptr) const;

View File

@ -83,10 +83,9 @@ namespace MWClass
return ref->mBase->mData.mHealth; return ref->mBase->mData.mHealth;
} }
std::string Armor::getScript (const MWWorld::Ptr& ptr) const std::string Armor::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Armor> *ref = const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
ptr.get<ESM::Armor>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -36,7 +36,7 @@ namespace MWClass
virtual int getItemMaxHealth (const MWWorld::Ptr& ptr) const; virtual int getItemMaxHealth (const MWWorld::Ptr& ptr) const;
///< Return item max health or throw an exception, if class does not have item health ///< Return item max health or throw an exception, if class does not have item health
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const; virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const;

View File

@ -78,10 +78,9 @@ namespace MWClass
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionRead(ptr)); return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionRead(ptr));
} }
std::string Book::getScript (const MWWorld::Ptr& ptr) const std::string Book::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Book> *ref = const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>();
ptr.get<ESM::Book>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -28,7 +28,7 @@ namespace MWClass
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual bool hasToolTip (const MWWorld::Ptr& ptr) const; virtual bool hasToolTip (const MWWorld::Ptr& ptr) const;

View File

@ -66,10 +66,9 @@ namespace MWClass
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
std::string Clothing::getScript (const MWWorld::Ptr& ptr) const std::string Clothing::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Clothing> *ref = const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
ptr.get<ESM::Clothing>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -28,7 +28,7 @@ namespace MWClass
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const; virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const;

View File

@ -209,10 +209,9 @@ namespace MWClass
return ptr.getRefData().getCustomData()->asContainerCustomData().mContainerStore; return ptr.getRefData().getCustomData()->asContainerCustomData().mContainerStore;
} }
std::string Container::getScript (const MWWorld::Ptr& ptr) const std::string Container::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Container> *ref = const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
ptr.get<ESM::Container>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -40,7 +40,7 @@ namespace MWClass
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const; virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
///< Return container store ///< Return container store
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual float getCapacity (const MWWorld::Ptr& ptr) const; virtual float getCapacity (const MWWorld::Ptr& ptr) const;

View File

@ -444,9 +444,9 @@ namespace MWClass
return isFlagBitSet(ptr, ESM::Creature::Weapon); return isFlagBitSet(ptr, ESM::Creature::Weapon);
} }
std::string Creature::getScript (const MWWorld::Ptr& ptr) const std::string Creature::getScript (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->mScript; return ref->mBase->mScript;
} }

View File

@ -74,7 +74,7 @@ namespace MWClass
virtual bool hasInventoryStore (const MWWorld::Ptr &ptr) const; virtual bool hasInventoryStore (const MWWorld::Ptr &ptr) const;
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual float getCapacity (const MWWorld::Ptr& ptr) const; virtual float getCapacity (const MWWorld::Ptr& ptr) const;

View File

@ -217,10 +217,9 @@ namespace MWClass
return true; return true;
} }
std::string Door::getScript (const MWWorld::Ptr& ptr) const std::string Door::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Door> *ref = const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
ptr.get<ESM::Door>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -49,7 +49,7 @@ namespace MWClass
virtual bool canLock(const MWWorld::Ptr &ptr) const; virtual bool canLock(const MWWorld::Ptr &ptr) const;
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
static void registerSelf(); static void registerSelf();

View File

@ -70,10 +70,9 @@ namespace MWClass
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
std::string Ingredient::getScript (const MWWorld::Ptr& ptr) const std::string Ingredient::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Ingredient> *ref = const MWWorld::LiveCellRef<ESM::Ingredient> *ref = ptr.get<ESM::Ingredient>();
ptr.get<ESM::Ingredient>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -34,7 +34,7 @@ namespace MWClass
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const; virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip. ///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const; virtual int getValue (const MWWorld::Ptr& ptr) const;

View File

@ -96,10 +96,9 @@ namespace MWClass
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
std::string Light::getScript (const MWWorld::Ptr& ptr) const std::string Light::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Light> *ref = const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
ptr.get<ESM::Light>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -34,7 +34,7 @@ namespace MWClass
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const; virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const;

View File

@ -65,10 +65,9 @@ namespace MWClass
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
std::string Lockpick::getScript (const MWWorld::Ptr& ptr) const std::string Lockpick::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Lockpick> *ref = const MWWorld::LiveCellRef<ESM::Lockpick> *ref = ptr.get<ESM::Lockpick>();
ptr.get<ESM::Lockpick>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -34,7 +34,7 @@ namespace MWClass
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const; virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip. ///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const; virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const;

View File

@ -78,10 +78,9 @@ namespace MWClass
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
std::string Miscellaneous::getScript (const MWWorld::Ptr& ptr) const std::string Miscellaneous::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = ptr.get<ESM::Miscellaneous>();
ptr.get<ESM::Miscellaneous>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -34,7 +34,7 @@ namespace MWClass
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const; virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip. ///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const; virtual int getValue (const MWWorld::Ptr& ptr) const;

View File

@ -799,10 +799,9 @@ namespace MWClass
return ptr.getRefData().getCustomData()->asNpcCustomData().mInventoryStore; return ptr.getRefData().getCustomData()->asNpcCustomData().mInventoryStore;
} }
std::string Npc::getScript (const MWWorld::Ptr& ptr) const std::string Npc::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::NPC> *ref = const MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
ptr.get<ESM::NPC>();
return ref->mBase->mScript; return ref->mBase->mScript;
} }

View File

@ -80,7 +80,7 @@ namespace MWClass
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual float getSpeed (const MWWorld::Ptr& ptr) const; virtual float getSpeed (const MWWorld::Ptr& ptr) const;

View File

@ -68,9 +68,9 @@ namespace MWClass
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
std::string Potion::getScript (const MWWorld::Ptr& ptr) const std::string Potion::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Potion> *ref = const MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>(); ptr.get<ESM::Potion>();
return ref->mBase->mScript; return ref->mBase->mScript;

View File

@ -34,7 +34,7 @@ namespace MWClass
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const; virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip. ///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const; virtual int getValue (const MWWorld::Ptr& ptr) const;

View File

@ -64,9 +64,9 @@ namespace MWClass
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
std::string Probe::getScript (const MWWorld::Ptr& ptr) const std::string Probe::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Probe> *ref = const MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>(); ptr.get<ESM::Probe>();
return ref->mBase->mScript; return ref->mBase->mScript;

View File

@ -34,7 +34,7 @@ namespace MWClass
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const; virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip. ///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const; virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const;

View File

@ -64,9 +64,9 @@ namespace MWClass
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
std::string Repair::getScript (const MWWorld::Ptr& ptr) const std::string Repair::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Repair> *ref = const MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>(); ptr.get<ESM::Repair>();
return ref->mBase->mScript; return ref->mBase->mScript;

View File

@ -34,7 +34,7 @@ namespace MWClass
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const; virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip. ///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual int getValue (const MWWorld::Ptr& ptr) const; virtual int getValue (const MWWorld::Ptr& ptr) const;

View File

@ -84,9 +84,9 @@ namespace MWClass
return ref->mBase->mData.mHealth; return ref->mBase->mData.mHealth;
} }
std::string Weapon::getScript (const MWWorld::Ptr& ptr) const std::string Weapon::getScript (const MWWorld::ConstPtr& ptr) const
{ {
MWWorld::LiveCellRef<ESM::Weapon> *ref = const MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>(); ptr.get<ESM::Weapon>();
return ref->mBase->mScript; return ref->mBase->mScript;

View File

@ -40,7 +40,7 @@ namespace MWClass
virtual int getItemMaxHealth (const MWWorld::Ptr& ptr) const; virtual int getItemMaxHealth (const MWWorld::Ptr& ptr) const;
///< Return item max health or throw an exception, if class does not have item health ///< Return item max health or throw an exception, if class does not have item health
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const; virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const MWWorld::Ptr& ptr) const;

View File

@ -158,7 +158,7 @@ namespace MWWorld
return -1; return -1;
} }
std::string Class::getScript (const Ptr& ptr) const std::string Class::getScript (const ConstPtr& ptr) const
{ {
return ""; return "";
} }

View File

@ -171,7 +171,7 @@ namespace MWWorld
///< Returns the remaining duration of the object, such as an equippable light ///< Returns the remaining duration of the object, such as an equippable light
/// source. (default implementation: -1, i.e. infinite) /// source. (default implementation: -1, i.e. infinite)
virtual std::string getScript (const Ptr& ptr) const; virtual std::string getScript (const ConstPtr& ptr) const;
///< Return name of the script attached to ptr (default implementation: return an empty ///< Return name of the script attached to ptr (default implementation: return an empty
/// string). /// string).