diff options
Diffstat (limited to 'src/entry.h')
-rw-r--r-- | src/entry.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/entry.h b/src/entry.h index 20f38e0..1badd40 100644 --- a/src/entry.h +++ b/src/entry.h @@ -8,14 +8,23 @@ namespace creature { } namespace entry { + class Entry; + + // Set up default text generation + std::string genText(const Entry& e, const creature::Creature& c); + class Entry : public Jsonable { public: + static std::shared_ptr<Entry> create(const nlohmann::json& data); virtual ~Entry() {} std::string getName(void) const {return name;} std::string getType(void) const {return type;} - std::string getText(void) const {return text;} - virtual std::string getText(const creature::Creature& c) const; + virtual std::string getText(void) const {return text;} + virtual std::string getText(const creature::Creature& c) const { + //return genText(*this, c); + return genText(*this, c) + ": " + getText(); + } virtual nlohmann::json toJson(void) const { return nlohmann::json({ @@ -33,7 +42,4 @@ namespace entry { const std::string type; const std::string text; }; - - // Set up default text generation - std::string genText(const Entry& e, const creature::Creature& c); } |