From 3b3ca65562375b3cfdf8919acae8c3259df05c91 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 25 Nov 2011 15:17:54 +0200 Subject: Add names to NodeMetadata --- src/nodemetadata.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/nodemetadata.h') diff --git a/src/nodemetadata.h b/src/nodemetadata.h index 9eb08678a..67b80b642 100644 --- a/src/nodemetadata.h +++ b/src/nodemetadata.h @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef NODEMETADATA_HEADER #define NODEMETADATA_HEADER -#include "common_irrlicht.h" +#include "irrlichttypes.h" #include #include @@ -44,11 +44,12 @@ public: NodeMetadata(IGameDef *gamedef); virtual ~NodeMetadata(); + static NodeMetadata* create(const std::string &name, IGameDef *gamedef); static NodeMetadata* deSerialize(std::istream &is, IGameDef *gamedef); void serialize(std::ostream &os); - // This usually is the CONTENT_ value virtual u16 typeId() const = 0; + virtual const char* typeName() const = 0; virtual NodeMetadata* clone(IGameDef *gamedef) = 0; virtual void serializeBody(std::ostream &os) = 0; virtual std::string infoText() {return "";} @@ -69,10 +70,11 @@ public: virtual std::string getText(){ return ""; } virtual void setText(const std::string &t){} protected: - static void registerType(u16 id, Factory f); + static void registerType(u16 id, const std::string &name, Factory f); IGameDef *m_gamedef; private: static core::map m_types; + static core::map m_names; }; /* -- cgit v1.2.3