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

This commit is contained in:
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
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

View File

@ -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 "<<PP(getPos())
<<": Node timers"<<std::endl);
m_node_timers.deSerialize(is);
}
}*/
// Static objects
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())