diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index 0e3df53a26..ff2d559f46 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 a649ce6efe..5639117b72 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 a141ef0148..1a936e76ba 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 89a097b79e..96c838e8d9 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 cdeeb06e09..1a339c7034 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 0bc3856ceb..4a6cd2f75d 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 2f89e24815..d162698571 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 e7cde69fa9..b9a03f2e76 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 820034cbf3..a728394d94 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 a37ac8f438..1b8dcf16dc 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 be194d71ab..a6df294e7d 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 c26bb2e488..0b907b2b79 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 a367b0f8fa..198c0e72fd 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 a583fb6d42..5056501c5c 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 700a3190b5..53dd34bb48 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 a8e8f5a1d7..81965efd58 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 20472e6f80..50bd749c80 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 2dc15b5280..ae2c90ec71 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 4d0d4f567f..6ae80c4408 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 2ed4aa66b0..eed520cb15 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 d0e466b014..6ed9ab2e53 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 2047d40259..0b71b072c8 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 4ab18ea702..bf983259b7 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 a1c7b7c0f4..8fa53aeaf9 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 ed7ce3eaa5..ee861c30b3 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 32e641a088..daff07f85f 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 04b76fe6a2..eabb7ba7ae 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 94b699d539..d2f685d406 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 97bcd54ade..dbb7f2a934 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 48367bc711..76c56de40e 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 21f8f4f994..75f2f6ccb2 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 c0d3faca68..350aba1569 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 c19c873b44..65fbf47cbf 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 dd0215c712..1a60f220a5 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 d5bc79fc7d..722baebde3 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 81beec6280..e7a9928ede 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 ab601ff42e..f2bc4f6357 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 aa462d0a16..fb80801827 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 de45582ef2..5ca80bcb7b 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 e14750bca2..98e5930f87 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 3d9eee7bed..ceaf142923 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)