From b27700a7e0b281ece3dea23060c17e0cae28715d Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 20 May 2021 17:00:53 -0400 Subject: Reduced exposure of implementation details --- src/weapon.h | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/weapon.h') diff --git a/src/weapon.h b/src/weapon.h index da6700c..707edd9 100644 --- a/src/weapon.h +++ b/src/weapon.h @@ -11,6 +11,7 @@ namespace creature { namespace entry { class Weapon; class Damage; + struct weaponImpl; std::vector getAbilityOptions(const Weapon& w); std::vector rollDmg(const Weapon& w, bool versatile=false); @@ -27,26 +28,21 @@ namespace entry { class Weapon : public Item, public Substantial { public: - std::vector getDamage(void) const {return damage;} - std::set getProperties(void) const {return properties;} - std::string getWeaponType(void) const {return weapon_type;} - std::pair getRange(void) const {return range;} - int getReach(void) const {return reach;} - int getCost(void) const {return cost;} - double getWeight(void) const {return weight;} + Weapon(); + + std::vector getDamage(void) const; + std::set getProperties(void) const; + std::string getWeaponType(void) const; + std::pair getRange(void) const; + int getReach(void) const; + int getCost(void) const; + double getWeight(void) const; virtual std::string getText() const override; virtual std::string getText(const creature::Creature& c) const override; - NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Item, Weapon, damage, properties, weapon_type, range, reach, cost, weight); - + NLOHMANN_FRIEND_DECLARES(Weapon); private: - std::vector damage; - std::set properties; - std::string weapon_type; - std::pair range; - int reach; - int cost; - double weight; + std::shared_ptr data; }; } -- cgit v1.2.3