From ea62ee4b61371107ef3d693bda4c410ba02ca7e6 Mon Sep 17 00:00:00 2001 From: darkrose Date: Wed, 18 Jul 2012 05:04:38 +1000 Subject: Increase node id/param0 to 16 bits, leaving param2 always with 8 bits --- src/mapblock.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/mapblock.cpp') diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 62c670fd3..571c2082d 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -582,8 +582,7 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk) tmp_nodes[i] = data[i]; getBlockNodeIdMapping(&nimap, tmp_nodes, m_gamedef->ndef()); - u8 content_width = 1; - /*u8 content_width = (nimap.size() <= 255) ? 1 : 2;*/ + u8 content_width = (version < 24) ? 1 : 2; u8 params_width = 2; writeU8(os, content_width); writeU8(os, params_width); @@ -593,8 +592,7 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk) } else { - u8 content_width = 1; - /*u8 content_width = 2;*/ + u8 content_width = 2; u8 params_width = 2; writeU8(os, content_width); writeU8(os, params_width); @@ -666,7 +664,7 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk) u32 nodecount = MAP_BLOCKSIZE*MAP_BLOCKSIZE*MAP_BLOCKSIZE; u8 content_width = readU8(is); u8 params_width = readU8(is); - if(content_width != 1) + if(content_width != 1 && content_width != 2) throw SerializationError("MapBlock::deSerialize(): invalid content_width"); if(params_width != 2) throw SerializationError("MapBlock::deSerialize(): invalid params_width"); -- cgit v1.2.3