- u8 buf[6];
-
- is.read((char*)buf, 2);
- u16 count = readU16(buf);
-
- for(u16 i=0; i<count; i++)
- {
- is.read((char*)buf, 2);
- u16 p16 = readU16(buf);
-
- v3s16 p(0,0,0);
- p.Z += p16 / MAP_BLOCKSIZE / MAP_BLOCKSIZE;
- p16 -= p.Z * MAP_BLOCKSIZE * MAP_BLOCKSIZE;
- p.Y += p16 / MAP_BLOCKSIZE;
- p16 -= p.Y * MAP_BLOCKSIZE;
- p.X += p16;
-
- if(m_data.find(p))
- {
- dstream<<"ERROR: NodeMetadataList::deSerialize(): "
+ u8 version = readU8(is);
+
+ if (version == 0) {
+ // Nothing
+ return;
+ }
+
+ if (version != 1) {
+ std::string err_str = std::string(FUNCTION_NAME)
+ + ": version " + itos(version) + " not supported";
+ infostream << err_str << std::endl;
+ throw SerializationError(err_str);
+ }
+
+ u16 count = readU16(is);
+
+ for (u16 i=0; i < count; i++) {
+ u16 p16 = readU16(is);
+
+ v3s16 p;
+ p.Z = p16 / MAP_BLOCKSIZE / MAP_BLOCKSIZE;
+ p16 &= MAP_BLOCKSIZE * MAP_BLOCKSIZE - 1;
+ p.Y = p16 / MAP_BLOCKSIZE;
+ p16 &= MAP_BLOCKSIZE - 1;
+ p.X = p16;
+
+ if (m_data.find(p) != m_data.end()) {
+ warningstream<<"NodeMetadataList::deSerialize(): "