diff options
author | Your Name <you@example.com> | 2021-05-20 17:00:53 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-05-20 17:00:53 -0400 |
commit | b27700a7e0b281ece3dea23060c17e0cae28715d (patch) | |
tree | ef13e98281dd0183c4fb1e32cdf371ea1f6c1794 /src/weapon.h | |
parent | be88609c825e18201f240415fe74a31c1a789484 (diff) | |
download | dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.gz dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.bz2 dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.zip |
Reduced exposure of implementation details
Diffstat (limited to 'src/weapon.h')
-rw-r--r-- | src/weapon.h | 28 |
1 files changed, 12 insertions, 16 deletions
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<rules::Ability> getAbilityOptions(const Weapon& w); std::vector<Damage> rollDmg(const Weapon& w, bool versatile=false); @@ -27,26 +28,21 @@ namespace entry { class Weapon : public Item, public Substantial { public: - std::vector<Damage> getDamage(void) const {return damage;} - std::set<std::string> getProperties(void) const {return properties;} - std::string getWeaponType(void) const {return weapon_type;} - std::pair<int, int> 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<Damage> getDamage(void) const; + std::set<std::string> getProperties(void) const; + std::string getWeaponType(void) const; + std::pair<int, int> 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> damage; - std::set<std::string> properties; - std::string weapon_type; - std::pair<int, int> range; - int reach; - int cost; - double weight; + std::shared_ptr<weaponImpl> data; }; } |