From: Perttu Ahola Date: Fri, 8 Jun 2012 11:57:02 +0000 (+0300) Subject: Update and fix doc/mapformat.txt; make current format more solid in mapblock.cpp X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=e74668ef7f68156ef9c24ecc97d130ca53f8c624;p=zefram%2Fminetest%2Fminetest_engine.git Update and fix doc/mapformat.txt; make current format more solid in mapblock.cpp --- diff --git a/doc/mapformat.txt b/doc/mapformat.txt index a7380b35..ce00d276 100644 --- a/doc/mapformat.txt +++ b/doc/mapformat.txt @@ -1,13 +1,13 @@ -================================================= -Minetest World Format used as of 0.4.dev-20120322 -================================================= +============================= +Minetest World Format 22...23 +============================= -This applies to a world format carrying the block serialization version 22 -which is used at least in version 0.4.dev-20120322. +This applies to a world format carrying the block serialization version +22...23, used at least in 0.4.dev-20120322 ... 0.4.dev-20120606. -The block serialization version used is 22. It does not fully specify every -aspect of this format; if compliance with this format is to be checked, it -needs to be done by detecting if the files and data indeed follows it. +The block serialization version does not fully specify every aspect of this +format; if compliance with this format is to be checked, it needs to be +done by detecting if the files and data indeed follows it. Legacy stuff ============= @@ -20,8 +20,8 @@ Files Everything is contained in a directory, the name of which is freeform, but often serves as the name of the world. -Currently the authentication and ban data is stored on a per-world basis. It -can be copied over from an old world to a newly created world. +Currently the authentication and ban data is stored on a per-world basis. +It can be copied over from an old world to a newly created world. World |-- auth.txt ----- Authentication data @@ -283,9 +283,9 @@ zlib-compressed node metadata list u16 content_size u8[content_size] (content of metadata) -u16 mapblockobject_count -- Always 0 -- Should be removed in version 23 (TODO) +- unused node timers (version will be 24 when they are actually used): +if version == 23: + u8 unused version (always 0) u8 static object version: - Always 0 diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 70a0f6ed..c4d3c422 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -616,9 +616,13 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk) */ if(disk) { - // Node timers - if(version >= 23) - m_node_timers.serialize(os); + // Version 23 doesn't actually contain node timers + // (this field should have not been added) + if(version == 23) + writeU8(os, 0); + // Node timers (uncomment when node timers are taken into use) + /*if(version >= 24) + m_node_timers.serialize(os);*/ // Static objects m_static_objects.serialize(os); @@ -698,11 +702,15 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk) if(disk) { // Node timers - if(version >= 23){ + if(version == 23) + // Read unused zero + readU8(is); + // Uncomment when node timers are taken into use + /*else if(version >= 24){ TRACESTREAM(<<"MapBlock::deSerialize "<