aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapgen')
-rw-r--r--src/mapgen/mg_schematic.cpp9
-rw-r--r--src/mapgen/mg_schematic.h1
2 files changed, 7 insertions, 3 deletions
diff --git a/src/mapgen/mg_schematic.cpp b/src/mapgen/mg_schematic.cpp
index 848a43626..b9ba70302 100644
--- a/src/mapgen/mg_schematic.cpp
+++ b/src/mapgen/mg_schematic.cpp
@@ -339,7 +339,9 @@ bool Schematic::deserializeFromMts(std::istream *is)
delete []schemdata;
schemdata = new MapNode[nodecount];
- MapNode::deSerializeBulk(ss, SER_FMT_VER_HIGHEST_READ, schemdata,
+ std::stringstream d_ss(std::ios_base::binary | std::ios_base::in | std::ios_base::out);
+ decompress(ss, d_ss, MTSCHEM_MAPNODE_SER_FMT_VER);
+ MapNode::deSerializeBulk(d_ss, MTSCHEM_MAPNODE_SER_FMT_VER, schemdata,
nodecount, 2, 2);
// Fix probability values for nodes that were ignore; removed in v2
@@ -384,8 +386,9 @@ bool Schematic::serializeToMts(std::ostream *os) const
}
// compressed bulk node data
- MapNode::serializeBulk(ss, SER_FMT_VER_HIGHEST_WRITE,
- schemdata, size.X * size.Y * size.Z, 2, 2, -1);
+ SharedBuffer<u8> buf = MapNode::serializeBulk(MTSCHEM_MAPNODE_SER_FMT_VER,
+ schemdata, size.X * size.Y * size.Z, 2, 2);
+ compress(buf, ss, MTSCHEM_MAPNODE_SER_FMT_VER);
return true;
}
diff --git a/src/mapgen/mg_schematic.h b/src/mapgen/mg_schematic.h
index 5f64ea280..9189bb3a7 100644
--- a/src/mapgen/mg_schematic.h
+++ b/src/mapgen/mg_schematic.h
@@ -70,6 +70,7 @@ class Server;
#define MTSCHEM_FILE_SIGNATURE 0x4d54534d // 'MTSM'
#define MTSCHEM_FILE_VER_HIGHEST_READ 4
#define MTSCHEM_FILE_VER_HIGHEST_WRITE 4
+#define MTSCHEM_MAPNODE_SER_FMT_VER 28 // Fixed serialization version for schematics since these still need to use Zlib
#define MTSCHEM_PROB_MASK 0x7F