+ else{
+ param0 = readU8(source+0);
+ param1 = readU8(source+1);
+ param2 = readU8(source+2);
+ if(param0 > 0x7F){
+ param0 |= ((param2&0xF0)<<4);
+ param2 &= 0x0F;
+ }
+ }
+}
+void MapNode::serializeBulk(std::ostream &os, int version,
+ const MapNode *nodes, u32 nodecount,
+ u8 content_width, u8 params_width, bool compressed)
+{
+ if(!ser_ver_supported(version))
+ throw VersionMismatchException("ERROR: MapNode format not supported");
+
+ assert(content_width == 2);
+ assert(params_width == 2);
+
+ // Can't do this anymore; we have 16-bit dynamically allocated node IDs
+ // in memory; conversion just won't work in this direction.
+ if(version < 24)
+ throw SerializationError("MapNode::serializeBulk: serialization to "
+ "version < 24 not possible");
+
+ SharedBuffer<u8> databuf(nodecount * (content_width + params_width));
+
+ // Serialize content
+ for(u32 i=0; i<nodecount; i++)
+ writeU16(&databuf[i*2], nodes[i].param0);
+
+ // Serialize param1
+ u32 start1 = content_width * nodecount;
+ for(u32 i=0; i<nodecount; i++)
+ writeU8(&databuf[start1 + i], nodes[i].param1);
+
+ // Serialize param2
+ u32 start2 = (content_width + 1) * nodecount;
+ for(u32 i=0; i<nodecount; i++)
+ writeU8(&databuf[start2 + i], nodes[i].param2);
+
+ /*
+ Compress data to output stream
+ */
+
+ if(compressed)