X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fnodemetadata.cpp;h=3edf6d3c28ac58e6fe0ae7ab8eb6ff7c281c9987;hb=30c34cc23e9a060ef964854038a314a94ad5cbae;hp=fca4e5b845b14881d52d907022952f327755d87d;hpb=9e683fff50ba4fef407613adf8407b31adca4596;p=dragonfireclient.git diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp index fca4e5b84..3edf6d3c2 100644 --- a/src/nodemetadata.cpp +++ b/src/nodemetadata.cpp @@ -21,6 +21,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "utility.h" #include "mapnode.h" #include "exceptions.h" +#include "inventory.h" +#include +#include "content_mapnode.h" /* NodeMetadata @@ -38,21 +41,39 @@ NodeMetadata::~NodeMetadata() NodeMetadata* NodeMetadata::deSerialize(std::istream &is) { + // Read id u8 buf[2]; is.read((char*)buf, 2); s16 id = readS16(buf); - + + // Read data + std::string data = deSerializeString(is); + + // Find factory function core::map::Node *n; n = m_types.find(id); if(n == NULL) { - dstream<<"NodeMetadata(): No factory for typeId="< 1) + { + dstream<<__FUNCTION_NAME<<": version "<::Iterator + i = m_data.getIterator(); + i.atEnd()==false; i++) + { + v3s16 p = i.getNode()->getKey(); + NodeMetadata *meta = i.getNode()->getValue(); + bool changed = meta->step(dtime); + if(changed) + something_changed = true; + } + return something_changed; +} +