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/armor.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/armor.cc') diff --git a/src/armor.cc b/src/armor.cc index d7e7e57..3a429b3 100644 --- a/src/armor.cc +++ b/src/armor.cc @@ -8,6 +8,27 @@ using namespace std; namespace entry{ + struct armorImpl { + int ac; + std::string armor_type; + int strength; + bool disadvantage; + int cost; + double weight; + }; + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(armorImpl, ac, armor_type, strength, disadvantage, cost, weight); + + NLOHMANN_FRIEND_DEFS(Item, Armor, data); + + Armor::Armor() : data(new armorImpl()) {} + + int Armor::getACBonus(void) const {return data->ac;} + std::string Armor::getArmorType(void) const {return data->armor_type;} + int Armor::getStrRequirement(void) const {return data->strength;} + bool Armor::stealthDisadvantage(void) const {return data->disadvantage;} + int Armor::getCost(void) const {return data->cost;} + double Armor::getWeight(void) const {return data->weight;} + string getTextHelper(const Armor& a, string dexBonusLight, string dexBonusMedium) { stringstream text; text << "AC: " << a.getACBonus(); @@ -30,7 +51,6 @@ namespace entry{ return getTextHelper(*this, "", ""); } - string Armor::getText(const creature::Creature& c) const { stringstream text; text << getName() << " (" << getType() << "): "; -- cgit v1.2.3