1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

changed node metadata format to better accomodate future needs and problems

This commit is contained in:
Perttu Ahola 2011-04-05 00:24:47 +03:00
parent 042834b09d
commit 389fe31ace
12 changed files with 192 additions and 46 deletions

View file

@ -56,6 +56,9 @@ public:
virtual void serializeBody(std::ostream &os) = 0;
virtual std::string infoText() {return "<todo: remove this text>";}
virtual Inventory* getInventory() {return NULL;}
// This is called always after the inventory is modified, before
// the changes are copied elsewhere
virtual void inventoryModified(){}
protected:
static void registerType(u16 id, Factory f);
@ -99,6 +102,28 @@ private:
Inventory *m_inventory;
};
class FurnaceNodeMetadata : public NodeMetadata
{
public:
FurnaceNodeMetadata();
~FurnaceNodeMetadata();
virtual u16 typeId() const;
virtual NodeMetadata* clone();
static NodeMetadata* create(std::istream &is);
virtual void serializeBody(std::ostream &os);
virtual std::string infoText();
virtual Inventory* getInventory() {return m_inventory;}
virtual void inventoryModified();
private:
Inventory *m_inventory;
};
/*
List of metadata of all the nodes of a block
*/
class NodeMetadataList
{
public: