aboutsummaryrefslogtreecommitdiff
path: root/src/mapblock.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-05 00:24:47 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-05 00:24:47 +0300
commit389fe31ace38a8f53c210ff5ae823eae1780dfc8 (patch)
tree3d66530794524c140a420e6f6c665c94e7d49162 /src/mapblock.cpp
parent042834b09d8d2d814204244e3a64f5fb1cb7582c (diff)
downloadminetest-389fe31ace38a8f53c210ff5ae823eae1780dfc8.tar.gz
minetest-389fe31ace38a8f53c210ff5ae823eae1780dfc8.tar.bz2
minetest-389fe31ace38a8f53c210ff5ae823eae1780dfc8.zip
changed node metadata format to better accomodate future needs and problems
Diffstat (limited to 'src/mapblock.cpp')
-rw-r--r--src/mapblock.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index efa760f0e..a4e13320e 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -1922,7 +1922,9 @@ void MapBlock::serialize(std::ostream &os, u8 version)
*/
if(version >= 14)
{
- m_node_metadata.serialize(os);
+ std::ostringstream oss(std::ios_base::binary);
+ m_node_metadata.serialize(oss);
+ os<<serializeString(oss.str());
}
}
}
@@ -2043,7 +2045,17 @@ void MapBlock::deSerialize(std::istream &is, u8 version)
*/
if(version >= 14)
{
- m_node_metadata.deSerialize(is);
+ // Ignore errors
+ try{
+ std::string data = deSerializeString(is);
+ std::istringstream iss(data, std::ios_base::binary);
+ m_node_metadata.deSerialize(iss);
+ }
+ catch(SerializationError &e)
+ {
+ dstream<<"WARNING: MapBlock::deSerialize(): Ignoring an error"
+ <<" while deserializing node metadata"<<std::endl;
+ }
}
}