aboutsummaryrefslogtreecommitdiff
path: root/src/feature.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-04-15 15:23:23 -0400
committerYour Name <you@example.com>2021-04-15 15:23:23 -0400
commitdfce4d0398a8bafbb7ad7a31345af181c0269c09 (patch)
tree695162ff8cc25e146f52d9e26fe19ffa9934b3d6 /src/feature.cc
parent9034c3d2533177f7cb7a7ce939ec53f7fa63f60e (diff)
downloaddmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.tar.gz
dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.tar.bz2
dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.zip
Added spells
Diffstat (limited to 'src/feature.cc')
-rw-r--r--src/feature.cc29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/feature.cc b/src/feature.cc
index 2747631..84f23fe 100644
--- a/src/feature.cc
+++ b/src/feature.cc
@@ -1,5 +1,7 @@
#include "json.hpp"
#include "feature.h"
+#include "spellcasting.h"
+#include "utils.h"
#include <sstream>
#include <map>
@@ -8,30 +10,9 @@ typedef nlohmann::json json;
namespace feature {
shared_ptr<Feature> Feature::create(const json& data) {
+ if(data["type"] == "spellcasting") {
+ return utils::loadDFromJson<Feature, Spellcasting>(data);
+ }
return shared_ptr<Feature>(new Feature(data));
}
-
- Feature::Feature(const json& data) : name(data["name"]), type(data["type"]), text(data["text"]) {}
-
- Feature::~Feature() {}
-
- string Feature::getName() const {
- return name;
- }
-
- string Feature::getType() const {
- return type;
- }
-
- string Feature::getText() const {
- return text;
- }
-
- json Feature::toJson() const {
- return json({
- {"name", name},
- {"type", type},
- {"text", text}
- });
- }
}