From 239498bcd4f42d35da044f01f8d8731d85192fbf Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 3 Aug 2010 17:11:41 +0200 Subject: [PATCH] added getName function --- apps/openmw/mwclass/activator.cpp | 12 ++++++++++++ apps/openmw/mwclass/activator.hpp | 3 +++ apps/openmw/mwclass/apparatus.cpp | 12 ++++++++++++ apps/openmw/mwclass/apparatus.hpp | 3 +++ apps/openmw/mwclass/armor.cpp | 8 ++++++++ apps/openmw/mwclass/armor.hpp | 4 ++++ apps/openmw/mwclass/book.cpp | 12 ++++++++++++ apps/openmw/mwclass/book.hpp | 3 +++ apps/openmw/mwclass/clothing.cpp | 12 ++++++++++++ apps/openmw/mwclass/clothing.hpp | 3 +++ apps/openmw/mwclass/container.cpp | 12 ++++++++++++ apps/openmw/mwclass/container.hpp | 3 +++ apps/openmw/mwclass/creature.cpp | 8 ++++++++ apps/openmw/mwclass/creature.hpp | 4 ++++ apps/openmw/mwclass/creaturelevlist.cpp | 5 +++++ apps/openmw/mwclass/creaturelevlist.hpp | 3 +++ apps/openmw/mwclass/door.cpp | 12 ++++++++++++ apps/openmw/mwclass/door.hpp | 3 +++ apps/openmw/mwclass/ingredient.cpp | 12 ++++++++++++ apps/openmw/mwclass/ingredient.hpp | 3 +++ apps/openmw/mwclass/itemlevlist.cpp | 5 +++++ apps/openmw/mwclass/itemlevlist.hpp | 3 +++ apps/openmw/mwclass/light.cpp | 15 +++++++++++++++ apps/openmw/mwclass/light.hpp | 3 +++ apps/openmw/mwclass/lockpick.cpp | 12 ++++++++++++ apps/openmw/mwclass/lockpick.hpp | 3 +++ apps/openmw/mwclass/misc.cpp | 12 ++++++++++++ apps/openmw/mwclass/misc.hpp | 3 +++ apps/openmw/mwclass/npc.cpp | 8 ++++++++ apps/openmw/mwclass/npc.hpp | 4 ++++ apps/openmw/mwclass/potion.cpp | 12 ++++++++++++ apps/openmw/mwclass/potion.hpp | 3 +++ apps/openmw/mwclass/probe.cpp | 12 ++++++++++++ apps/openmw/mwclass/probe.hpp | 3 +++ apps/openmw/mwclass/repair.cpp | 12 ++++++++++++ apps/openmw/mwclass/repair.hpp | 3 +++ apps/openmw/mwclass/static.cpp | 5 +++++ apps/openmw/mwclass/static.hpp | 3 +++ apps/openmw/mwclass/weapon.cpp | 8 ++++++++ apps/openmw/mwclass/weapon.hpp | 4 ++++ apps/openmw/mwworld/class.hpp | 4 ++++ 41 files changed, 274 insertions(+) diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index 0e3df53a2..ff2d559f4 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Activator::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Activator::registerSelf() { boost::shared_ptr instance (new Activator); diff --git a/apps/openmw/mwclass/activator.hpp b/apps/openmw/mwclass/activator.hpp index a649ce6ef..5639117b7 100644 --- a/apps/openmw/mwclass/activator.hpp +++ b/apps/openmw/mwclass/activator.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp index a141ef014..1a936e76b 100644 --- a/apps/openmw/mwclass/apparatus.cpp +++ b/apps/openmw/mwclass/apparatus.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Apparatus::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Apparatus::registerSelf() { boost::shared_ptr instance (new Apparatus); diff --git a/apps/openmw/mwclass/apparatus.hpp b/apps/openmw/mwclass/apparatus.hpp index 89a097b79..96c838e8d 100644 --- a/apps/openmw/mwclass/apparatus.hpp +++ b/apps/openmw/mwclass/apparatus.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index cdeeb06e0..1a339c703 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -9,6 +9,14 @@ namespace MWClass { + std::string Armor::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + bool Armor::hasItemHealth (const MWWorld::Ptr& ptr) const { return true; diff --git a/apps/openmw/mwclass/armor.hpp b/apps/openmw/mwclass/armor.hpp index 0bc3856ce..4a6cd2f75 100644 --- a/apps/openmw/mwclass/armor.hpp +++ b/apps/openmw/mwclass/armor.hpp @@ -9,6 +9,10 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& 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 hasItemHealth (const MWWorld::Ptr& ptr) const; ///< \return Item health data available? diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index 2f89e2481..d16269857 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Book::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Book::registerSelf() { boost::shared_ptr instance (new Book); diff --git a/apps/openmw/mwclass/book.hpp b/apps/openmw/mwclass/book.hpp index e7cde69fa..b9a03f2e7 100644 --- a/apps/openmw/mwclass/book.hpp +++ b/apps/openmw/mwclass/book.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index 820034cbf..a728394d9 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Clothing::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Clothing::registerSelf() { boost::shared_ptr instance (new Clothing); diff --git a/apps/openmw/mwclass/clothing.hpp b/apps/openmw/mwclass/clothing.hpp index a37ac8f43..1b8dcf16d 100644 --- a/apps/openmw/mwclass/clothing.hpp +++ b/apps/openmw/mwclass/clothing.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index be194d71a..a6df294e7 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Container::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Container::registerSelf() { boost::shared_ptr instance (new Container); diff --git a/apps/openmw/mwclass/container.hpp b/apps/openmw/mwclass/container.hpp index c26bb2e48..0b907b2b7 100644 --- a/apps/openmw/mwclass/container.hpp +++ b/apps/openmw/mwclass/container.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index a367b0f8f..198c0e72f 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -9,6 +9,14 @@ namespace MWClass { + std::string Creature::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + MWMechanics::CreatureStats& Creature::getCreatureStats (const MWWorld::Ptr& ptr) const { if (!ptr.getRefData().getCreatureStats().get()) diff --git a/apps/openmw/mwclass/creature.hpp b/apps/openmw/mwclass/creature.hpp index a583fb6d4..5056501c5 100644 --- a/apps/openmw/mwclass/creature.hpp +++ b/apps/openmw/mwclass/creature.hpp @@ -9,6 +9,10 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. + virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const; ///< Return creature stats diff --git a/apps/openmw/mwclass/creaturelevlist.cpp b/apps/openmw/mwclass/creaturelevlist.cpp index 700a3190b..53dd34bb4 100644 --- a/apps/openmw/mwclass/creaturelevlist.cpp +++ b/apps/openmw/mwclass/creaturelevlist.cpp @@ -5,6 +5,11 @@ namespace MWClass { + std::string CreatureLevList::getName (const MWWorld::Ptr& ptr) const + { + return ""; + } + void CreatureLevList::registerSelf() { boost::shared_ptr instance (new CreatureLevList); diff --git a/apps/openmw/mwclass/creaturelevlist.hpp b/apps/openmw/mwclass/creaturelevlist.hpp index a8e8f5a1d..81965efd5 100644 --- a/apps/openmw/mwclass/creaturelevlist.hpp +++ b/apps/openmw/mwclass/creaturelevlist.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 20472e6f8..50bd749c8 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Door::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Door::registerSelf() { boost::shared_ptr instance (new Door); diff --git a/apps/openmw/mwclass/door.hpp b/apps/openmw/mwclass/door.hpp index 2dc15b528..ae2c90ec7 100644 --- a/apps/openmw/mwclass/door.hpp +++ b/apps/openmw/mwclass/door.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index 4d0d4f567..6ae80c440 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Ingredient::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Ingredient::registerSelf() { boost::shared_ptr instance (new Ingredient); diff --git a/apps/openmw/mwclass/ingredient.hpp b/apps/openmw/mwclass/ingredient.hpp index 2ed4aa66b..eed520cb1 100644 --- a/apps/openmw/mwclass/ingredient.hpp +++ b/apps/openmw/mwclass/ingredient.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/itemlevlist.cpp b/apps/openmw/mwclass/itemlevlist.cpp index d0e466b01..6ed9ab2e5 100644 --- a/apps/openmw/mwclass/itemlevlist.cpp +++ b/apps/openmw/mwclass/itemlevlist.cpp @@ -5,6 +5,11 @@ namespace MWClass { + std::string ItemLevList::getName (const MWWorld::Ptr& ptr) const + { + return ""; + } + void ItemLevList::registerSelf() { boost::shared_ptr instance (new ItemLevList); diff --git a/apps/openmw/mwclass/itemlevlist.hpp b/apps/openmw/mwclass/itemlevlist.hpp index 2047d4025..0b71b072c 100644 --- a/apps/openmw/mwclass/itemlevlist.hpp +++ b/apps/openmw/mwclass/itemlevlist.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index 4ab18ea70..bf983259b 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -3,8 +3,23 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Light::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + if (ref->base->model.empty()) + return ""; + + return ref->base->name; + } + void Light::registerSelf() { boost::shared_ptr instance (new Light); diff --git a/apps/openmw/mwclass/light.hpp b/apps/openmw/mwclass/light.hpp index a1c7b7c0f..8fa53aeaf 100644 --- a/apps/openmw/mwclass/light.hpp +++ b/apps/openmw/mwclass/light.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index ed7ce3eaa..ee861c30b 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Lockpick::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Lockpick::registerSelf() { boost::shared_ptr instance (new Lockpick); diff --git a/apps/openmw/mwclass/lockpick.hpp b/apps/openmw/mwclass/lockpick.hpp index 32e641a08..daff07f85 100644 --- a/apps/openmw/mwclass/lockpick.hpp +++ b/apps/openmw/mwclass/lockpick.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 04b76fe6a..eabb7ba7a 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Misc::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Misc::registerSelf() { boost::shared_ptr instance (new Misc); diff --git a/apps/openmw/mwclass/misc.hpp b/apps/openmw/mwclass/misc.hpp index 94b699d53..d2f685d40 100644 --- a/apps/openmw/mwclass/misc.hpp +++ b/apps/openmw/mwclass/misc.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 97bcd54ad..dbb7f2a93 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -9,6 +9,14 @@ namespace MWClass { + std::string Npc::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + MWMechanics::CreatureStats& Npc::getCreatureStats (const MWWorld::Ptr& ptr) const { if (!ptr.getRefData().getCreatureStats().get()) diff --git a/apps/openmw/mwclass/npc.hpp b/apps/openmw/mwclass/npc.hpp index 48367bc71..76c56de40 100644 --- a/apps/openmw/mwclass/npc.hpp +++ b/apps/openmw/mwclass/npc.hpp @@ -9,6 +9,10 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. + virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const; ///< Return creature stats diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index 21f8f4f99..75f2f6ccb 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Potion::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Potion::registerSelf() { boost::shared_ptr instance (new Potion); diff --git a/apps/openmw/mwclass/potion.hpp b/apps/openmw/mwclass/potion.hpp index c0d3faca6..350aba156 100644 --- a/apps/openmw/mwclass/potion.hpp +++ b/apps/openmw/mwclass/potion.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp index c19c873b4..65fbf47cb 100644 --- a/apps/openmw/mwclass/probe.cpp +++ b/apps/openmw/mwclass/probe.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Probe::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Probe::registerSelf() { boost::shared_ptr instance (new Probe); diff --git a/apps/openmw/mwclass/probe.hpp b/apps/openmw/mwclass/probe.hpp index dd0215c71..1a60f220a 100644 --- a/apps/openmw/mwclass/probe.hpp +++ b/apps/openmw/mwclass/probe.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp index d5bc79fc7..722baebde 100644 --- a/apps/openmw/mwclass/repair.cpp +++ b/apps/openmw/mwclass/repair.cpp @@ -3,8 +3,20 @@ #include +#include + +#include "../mwworld/ptr.hpp" + namespace MWClass { + std::string Repair::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + void Repair::registerSelf() { boost::shared_ptr instance (new Repair); diff --git a/apps/openmw/mwclass/repair.hpp b/apps/openmw/mwclass/repair.hpp index 81beec628..e7a9928ed 100644 --- a/apps/openmw/mwclass/repair.hpp +++ b/apps/openmw/mwclass/repair.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/static.cpp b/apps/openmw/mwclass/static.cpp index ab601ff42..f2bc4f635 100644 --- a/apps/openmw/mwclass/static.cpp +++ b/apps/openmw/mwclass/static.cpp @@ -5,6 +5,11 @@ namespace MWClass { + std::string Static::getName (const MWWorld::Ptr& ptr) const + { + return ""; + } + void Static::registerSelf() { boost::shared_ptr instance (new Static); diff --git a/apps/openmw/mwclass/static.hpp b/apps/openmw/mwclass/static.hpp index aa462d0a1..fb8080182 100644 --- a/apps/openmw/mwclass/static.hpp +++ b/apps/openmw/mwclass/static.hpp @@ -9,6 +9,9 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& ptr) const; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. static void registerSelf(); }; diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index de45582ef..5ca80bcb7 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -9,6 +9,14 @@ namespace MWClass { + std::string Weapon::getName (const MWWorld::Ptr& ptr) const + { + ESMS::LiveCellRef *ref = + ptr.get(); + + return ref->base->name; + } + bool Weapon::hasItemHealth (const MWWorld::Ptr& ptr) const { return true; diff --git a/apps/openmw/mwclass/weapon.hpp b/apps/openmw/mwclass/weapon.hpp index e14750bca..98e5930f8 100644 --- a/apps/openmw/mwclass/weapon.hpp +++ b/apps/openmw/mwclass/weapon.hpp @@ -9,6 +9,10 @@ namespace MWClass { public: + virtual std::string getName (const MWWorld::Ptr& 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 hasItemHealth (const MWWorld::Ptr& ptr) const; ///< \return Item health data available? diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 3d9eee7be..ceaf14292 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -32,6 +32,10 @@ namespace MWWorld virtual ~Class(); + virtual std::string getName (const Ptr& ptr) const = 0; + ///< \return name (the one that is to be presented to the user; not the internal one); + /// can return an empty string. + virtual MWMechanics::CreatureStats& getCreatureStats (const Ptr& ptr) const; ///< Return creature stats or throw an exception, if class does not have creature stats /// (default implementation: throw an exceoption)