aboutsummaryrefslogtreecommitdiff
path: root/src/feature.cc
diff options
context:
space:
mode:
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}
- });
- }
}