From ec1311fcb79875c5d732c4025da795f7afd88acb Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 1 Apr 2018 09:33:07 +0300 Subject: [PATCH] [Client] Make it possible to check whether a class has a ContainerStore --- apps/openmw/mwclass/container.hpp | 10 ++++++++++ apps/openmw/mwclass/creature.hpp | 10 ++++++++++ apps/openmw/mwclass/npc.hpp | 10 ++++++++++ apps/openmw/mwworld/class.cpp | 13 +++++++++++++ apps/openmw/mwworld/class.hpp | 11 +++++++++++ 5 files changed, 54 insertions(+) diff --git a/apps/openmw/mwclass/container.hpp b/apps/openmw/mwclass/container.hpp index e38d98b5c..f3d6e6cd8 100644 --- a/apps/openmw/mwclass/container.hpp +++ b/apps/openmw/mwclass/container.hpp @@ -36,6 +36,16 @@ namespace MWClass virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const; ///< Return container store + /* + Start of tes3mp addition + + Make it possible to check whether a class has a container store + */ + virtual bool hasContainerStore(const MWWorld::Ptr &ptr) const { return true; } + /* + End of tes3mp addition + */ + virtual std::string getScript (const MWWorld::ConstPtr& ptr) const; ///< Return name of the script attached to ptr diff --git a/apps/openmw/mwclass/creature.hpp b/apps/openmw/mwclass/creature.hpp index e3689204a..824a462a9 100644 --- a/apps/openmw/mwclass/creature.hpp +++ b/apps/openmw/mwclass/creature.hpp @@ -73,6 +73,16 @@ namespace MWClass virtual bool hasInventoryStore (const MWWorld::Ptr &ptr) const; + /* + Start of tes3mp addition + + Make it possible to check whether a class has a container store + */ + virtual bool hasContainerStore(const MWWorld::Ptr &ptr) const { return true; } + /* + End of tes3mp addition + */ + virtual std::string getScript (const MWWorld::ConstPtr& ptr) const; ///< Return name of the script attached to ptr diff --git a/apps/openmw/mwclass/npc.hpp b/apps/openmw/mwclass/npc.hpp index e91dc7113..dc856dd39 100644 --- a/apps/openmw/mwclass/npc.hpp +++ b/apps/openmw/mwclass/npc.hpp @@ -71,6 +71,16 @@ namespace MWClass virtual bool hasInventoryStore(const MWWorld::Ptr &ptr) const { return true; } + /* + Start of tes3mp addition + + Make it possible to check whether a class has a container store + */ + virtual bool hasContainerStore(const MWWorld::Ptr &ptr) const { return true; } + /* + End of tes3mp addition + */ + virtual void hit(const MWWorld::Ptr& ptr, float attackStrength, int type) const; virtual void onHit(const MWWorld::Ptr &ptr, float damage, bool ishealth, const MWWorld::Ptr &object, const MWWorld::Ptr &attacker, const osg::Vec3f &hitPosition, bool successful) const; diff --git a/apps/openmw/mwworld/class.cpp b/apps/openmw/mwworld/class.cpp index e59dde7b1..a8d4ee014 100644 --- a/apps/openmw/mwworld/class.cpp +++ b/apps/openmw/mwworld/class.cpp @@ -128,6 +128,19 @@ namespace MWWorld throw std::runtime_error ("class does not have an inventory store"); } + /* + Start of tes3mp addition + + Make it possible to check whether a class has a container store + */ + bool Class::hasContainerStore(const Ptr &ptr) const + { + return false; + } + /* + End of tes3mp addition + */ + bool Class::hasInventoryStore(const Ptr &ptr) const { return false; diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 097ec0faa..ebe160570 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -154,6 +154,17 @@ namespace MWWorld ///< Return inventory store or throw an exception, if class does not have a /// inventory store (default implementation: throw an exception) + /* + Start of tes3mp addition + + Make it possible to check whether a class has a container store + */ + virtual bool hasContainerStore(const Ptr& ptr) const; + ///< Does this object have a container store? (default implementation: false) + /* + End of tes3mp addition + */ + virtual bool hasInventoryStore (const Ptr& ptr) const; ///< Does this object have an inventory store, i.e. equipment slots? (default implementation: false)