aboutsummaryrefslogtreecommitdiff
path: root/src/mapblock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapblock.cpp')
-rw-r--r--src/mapblock.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index 38c081eec..5b8bc7b9f 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -1924,9 +1924,19 @@ void MapBlock::serialize(std::ostream &os, u8 version)
*/
if(version >= 14)
{
- std::ostringstream oss(std::ios_base::binary);
- m_node_metadata.serialize(oss);
- os<<serializeString(oss.str());
+ if(version <= 15)
+ {
+ std::ostringstream oss(std::ios_base::binary);
+ m_node_metadata.serialize(oss);
+ os<<serializeString(oss.str());
+ }
+ else
+ {
+ std::ostringstream oss(std::ios_base::binary);
+ m_node_metadata.serialize(oss);
+ compressZlib(oss.str(), os);
+ //os<<serializeLongString(oss.str());
+ }
}
}
}
@@ -2055,9 +2065,20 @@ void MapBlock::deSerialize(std::istream &is, u8 version)
{
// Ignore errors
try{
- std::string data = deSerializeString(is);
- std::istringstream iss(data, std::ios_base::binary);
- m_node_metadata.deSerialize(iss);
+ if(version <= 15)
+ {
+ std::string data = deSerializeString(is);
+ std::istringstream iss(data, std::ios_base::binary);
+ m_node_metadata.deSerialize(iss);
+ }
+ else
+ {
+ //std::string data = deSerializeLongString(is);
+ std::ostringstream oss(std::ios_base::binary);
+ decompressZlib(is, oss);
+ std::istringstream iss(oss.str(), std::ios_base::binary);
+ m_node_metadata.deSerialize(iss);
+ }
}
catch(SerializationError &e)
{