diff options
author | Your Name <you@example.com> | 2021-05-09 13:56:46 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-05-09 13:56:46 -0400 |
commit | d13358b71ec15085f2638fd9c3fc634df62dfc94 (patch) | |
tree | 467c643a068bf2d83da3632823a6434244ae004e /src/spellcasting.h | |
parent | e3aaa68a2ea1a403256150121c57a0287014162f (diff) | |
download | dmtool-d13358b71ec15085f2638fd9c3fc634df62dfc94.tar.gz dmtool-d13358b71ec15085f2638fd9c3fc634df62dfc94.tar.bz2 dmtool-d13358b71ec15085f2638fd9c3fc634df62dfc94.zip |
Reduced dependency on json-related hacks
Diffstat (limited to 'src/spellcasting.h')
-rw-r--r-- | src/spellcasting.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/spellcasting.h b/src/spellcasting.h index 6672dba..bb99756 100644 --- a/src/spellcasting.h +++ b/src/spellcasting.h @@ -11,7 +11,7 @@ typedef nlohmann::json json; namespace entry { struct SlotLevel : public Jsonable { - SlotLevel(const json& data) : numSlots(data["slots"]), spells(utils::jsonList2ptrvec<Spell>("spells", data["spells"])) {} + SlotLevel(const json& data) : numSlots(data["slots"]), spells(utils::instantiateNames<Spell>("spells", data["spells"])) {} SlotLevel() : numSlots(0) {} virtual ~SlotLevel() {} int numSlots; @@ -32,7 +32,7 @@ namespace entry { class Spellcasting : public Feature { public: - Spellcasting(const json& data, const json& base) : Feature(base), innate(data["innate"]), ability(rules::Ability(data["spellcasting_ability"])), spellsBySlot(utils::json2ptrvec<SlotLevel>(data["levels"])) {} + Spellcasting(const json& data, const json& base) : Feature(base), innate(data["innate"]), ability(rules::Ability(data["spellcasting_ability"])), spellsBySlot(data["levels"]) {} // Can also be instantiated programatically Spellcasting(const std::string& entry, const std::string& name, const std::string& type, const std::string& text, const rules::Ability& ability, bool isInnate) : Feature(entry, name, type, text), innate(isInnate), ability(ability) {} virtual ~Spellcasting() {} @@ -48,7 +48,7 @@ namespace entry { auto data = Feature::toJson(); data["innate"] = innate; data["spellcasting_ability"] = ability; - data["levels"] = utils::ptrvec2json(spellsBySlot); + data["levels"] = spellsBySlot; return data; } |