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.cc | |
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.cc')
-rw-r--r-- | src/weapon.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/weapon.cc b/src/weapon.cc index 0c4dc29..053dbc1 100644 --- a/src/weapon.cc +++ b/src/weapon.cc @@ -9,6 +9,30 @@ using namespace std; namespace entry { + struct weaponImpl { + std::vector<Damage> damage; + std::set<std::string> properties; + std::string weapon_type; + std::pair<int, int> range; + int reach; + int cost; + double weight; + }; + + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(weaponImpl, damage, properties, weapon_type, range, reach, cost, weight); + + NLOHMANN_FRIEND_DEFS(Item, Weapon, data); + + Weapon::Weapon() : data(new weaponImpl()) {} + + std::vector<Damage> Weapon::getDamage(void) const {return data->damage;} + std::set<std::string> Weapon::getProperties(void) const {return data->properties;} + std::string Weapon::getWeaponType(void) const {return data->weapon_type;} + std::pair<int, int> Weapon::getRange(void) const {return data->range;} + int Weapon::getReach(void) const {return data->reach;} + int Weapon::getCost(void) const {return data->cost;} + double Weapon::getWeight(void) const {return data->weight;} + string getTextHelper(const Weapon& w, string toHitBonus, string damageBonus) { stringstream text; text << "+" << toHitBonus << " to hit, "; |