aboutsummaryrefslogtreecommitdiff
path: root/src/armor.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-20 17:00:53 -0400
committerYour Name <you@example.com>2021-05-20 17:00:53 -0400
commitb27700a7e0b281ece3dea23060c17e0cae28715d (patch)
treeef13e98281dd0183c4fb1e32cdf371ea1f6c1794 /src/armor.cc
parentbe88609c825e18201f240415fe74a31c1a789484 (diff)
downloaddmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.gz
dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.bz2
dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.zip
Reduced exposure of implementation details
Diffstat (limited to 'src/armor.cc')
-rw-r--r--src/armor.cc22
1 files changed, 21 insertions, 1 deletions
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() << "): ";