aboutsummaryrefslogtreecommitdiff
path: root/src/item.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/item.h')
-rw-r--r--src/item.h33
1 files changed, 11 insertions, 22 deletions
diff --git a/src/item.h b/src/item.h
index a415947..096513e 100644
--- a/src/item.h
+++ b/src/item.h
@@ -1,33 +1,22 @@
#pragma once
#include "json.hpp"
-#include "jsonable.h"
+#include "entry.h"
#include <memory>
-namespace item {
- class Item : public Jsonable {
+namespace entry {
+ class Item : public Entry {
public:
static std::shared_ptr<Item> create(const nlohmann::json& data);
- virtual ~Item() {}
-
- std::string getName(void) const {return name;}
- std::string getType(void) const {return type;}
- virtual std::string getText(void) const {return text;}
-
- virtual nlohmann::json toJson(void) const {
- return nlohmann::json({
- {"name", name},
- {"type", type},
- {"text", text}
- });
- }
-
protected:
- Item(const nlohmann::json& data) : name(data["name"]), type(data["type"]), text(data["text"]) {};
+ Item(const nlohmann::json& data) : Entry(data) {};
+ };
- private:
- const std::string name;
- const std::string type;
- const std::string text;
+ class Substantial {
+ public:
+ virtual int getCost(void) const = 0;
+ virtual double getWeight(void) const = 0;
};
+
+ std::string genText(const Substantial& s);
}