From d13358b71ec15085f2638fd9c3fc634df62dfc94 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 9 May 2021 13:56:46 -0400 Subject: Reduced dependency on json-related hacks --- src/spellcasting.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/spellcasting.h') 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("spells", data["spells"])) {} + SlotLevel(const json& data) : numSlots(data["slots"]), spells(utils::instantiateNames("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(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; } -- cgit v1.2.3