From 9f3802690f9dd9452e96d1d7a879291978d66e35 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 6 May 2021 14:13:28 -0400 Subject: Refactoring --- src/spellcasting.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/spellcasting.h') diff --git a/src/spellcasting.h b/src/spellcasting.h index 331a95f..6672dba 100644 --- a/src/spellcasting.h +++ b/src/spellcasting.h @@ -4,13 +4,14 @@ #include "spell.h" #include "jsonable.h" #include "rules.h" +#include "utils.h" #include typedef nlohmann::json json; namespace entry { struct SlotLevel : public Jsonable { - SlotLevel(const json& data) : numSlots(data["slots"]), spells(jsonList2ptrvec("spells", data["spells"])) {} + SlotLevel(const json& data) : numSlots(data["slots"]), spells(utils::jsonList2ptrvec("spells", data["spells"])) {} SlotLevel() : numSlots(0) {} virtual ~SlotLevel() {} int numSlots; @@ -31,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(json2ptrvec(data["levels"])) {} + Spellcasting(const json& data, const json& base) : Feature(base), innate(data["innate"]), ability(rules::Ability(data["spellcasting_ability"])), spellsBySlot(utils::json2ptrvec(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() {} @@ -47,7 +48,7 @@ namespace entry { auto data = Feature::toJson(); data["innate"] = innate; data["spellcasting_ability"] = ability; - data["levels"] = ptrvec2json(spellsBySlot); + data["levels"] = utils::ptrvec2json(spellsBySlot); return data; } -- cgit v1.2.3