Update and fix doc/mapformat.txt; make current format more solid in mapblock.cpp

master
Perttu Ahola 2012-06-08 14:57:02 +03:00
parent 22502f80db
commit e74668ef7f
2 changed files with 26 additions and 18 deletions

View File

@ -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 This applies to a world format carrying the block serialization version
which is used at least in version 0.4.dev-20120322. 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 The block serialization version does not fully specify every aspect of this
aspect of this format; if compliance with this format is to be checked, it format; if compliance with this format is to be checked, it needs to be
needs to be done by detecting if the files and data indeed follows it. done by detecting if the files and data indeed follows it.
Legacy stuff Legacy stuff
============= =============
@ -20,8 +20,8 @@ Files
Everything is contained in a directory, the name of which is freeform, but Everything is contained in a directory, the name of which is freeform, but
often serves as the name of the world. often serves as the name of the world.
Currently the authentication and ban data is stored on a per-world basis. It Currently the authentication and ban data is stored on a per-world basis.
can be copied over from an old world to a newly created world. It can be copied over from an old world to a newly created world.
World World
|-- auth.txt ----- Authentication data |-- auth.txt ----- Authentication data
@ -283,9 +283,9 @@ zlib-compressed node metadata list
u16 content_size u16 content_size
u8[content_size] (content of metadata) u8[content_size] (content of metadata)
u16 mapblockobject_count - unused node timers (version will be 24 when they are actually used):
- Always 0 if version == 23:
- Should be removed in version 23 (TODO) u8 unused version (always 0)
u8 static object version: u8 static object version:
- Always 0 - Always 0

View File

@ -616,9 +616,13 @@ void MapBlock::serialize(std::ostream &os, u8 version, bool disk)
*/ */
if(disk) if(disk)
{ {
// Node timers // Version 23 doesn't actually contain node timers
if(version >= 23) // (this field should have not been added)
m_node_timers.serialize(os); 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 // Static objects
m_static_objects.serialize(os); m_static_objects.serialize(os);
@ -698,11 +702,15 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk)
if(disk) if(disk)
{ {
// Node timers // 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 "<<PP(getPos()) TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
<<": Node timers"<<std::endl); <<": Node timers"<<std::endl);
m_node_timers.deSerialize(is); m_node_timers.deSerialize(is);
} }*/
// Static objects // Static objects
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos()) TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())