aboutsummaryrefslogtreecommitdiff
path: root/src/spellcasting.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-06 14:13:28 -0400
committerYour Name <you@example.com>2021-05-06 14:13:28 -0400
commit9f3802690f9dd9452e96d1d7a879291978d66e35 (patch)
tree6d6c17b39abdb9490119241bc4fc061744b46d7d /src/spellcasting.h
parent2a9f262e6db5906db445d465e500d7ba8c90fab3 (diff)
downloaddmtool-9f3802690f9dd9452e96d1d7a879291978d66e35.tar.gz
dmtool-9f3802690f9dd9452e96d1d7a879291978d66e35.tar.bz2
dmtool-9f3802690f9dd9452e96d1d7a879291978d66e35.zip
Refactoring
Diffstat (limited to 'src/spellcasting.h')
-rw-r--r--src/spellcasting.h7
1 files changed, 4 insertions, 3 deletions
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 <memory>
typedef nlohmann::json json;
namespace entry {
struct SlotLevel : public Jsonable {
- SlotLevel(const json& data) : numSlots(data["slots"]), spells(jsonList2ptrvec<Spell>("spells", data["spells"])) {}
+ SlotLevel(const json& data) : numSlots(data["slots"]), spells(utils::jsonList2ptrvec<Spell>("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<SlotLevel>(data["levels"])) {}
+ Spellcasting(const json& data, const json& base) : Feature(base), innate(data["innate"]), ability(rules::Ability(data["spellcasting_ability"])), spellsBySlot(utils::json2ptrvec<SlotLevel>(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;
}