3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef NODEMETADATA_HEADER
21 #define NODEMETADATA_HEADER
23 #include "common_irrlicht.h"
31 - Item that is being burned
33 - Item stack that is being heated
43 typedef NodeMetadata* (*Factory)(std::istream&);
46 virtual ~NodeMetadata();
48 static NodeMetadata* deSerialize(std::istream &is);
49 void serialize(std::ostream &os);
51 // This usually is the CONTENT_ value
52 virtual u16 typeId() const = 0;
53 virtual NodeMetadata* clone() = 0;
54 virtual void serializeBody(std::ostream &os) = 0;
55 virtual std::string infoText() { return "<todo: remove this text>"; }
58 static void registerType(u16 id, Factory f);
60 static core::map<u16, Factory> m_types;
63 class SignNodeMetadata : public NodeMetadata
66 SignNodeMetadata(std::string text);
67 //~SignNodeMetadata();
69 virtual u16 typeId() const;
70 static NodeMetadata* create(std::istream &is);
71 virtual NodeMetadata* clone();
72 virtual void serializeBody(std::ostream &os);
73 virtual std::string infoText();
75 std::string getText(){ return m_text; }
76 void setText(std::string t){ m_text = t; }
82 class ChestNodeMetadata : public NodeMetadata
87 virtual u16 typeId() const;
88 static NodeMetadata* create(std::istream &is);
89 virtual NodeMetadata* clone();
90 virtual void serializeBody(std::ostream &os);
91 virtual std::string infoText();
96 class NodeMetadataList
101 void serialize(std::ostream &os);
102 void deSerialize(std::istream &is);
104 // Get pointer to data
105 NodeMetadata* get(v3s16 p);
107 void remove(v3s16 p);
108 // Deletes old data and sets a new one
109 void set(v3s16 p, NodeMetadata *d);
111 core::map<v3s16, NodeMetadata*> m_data;