aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen/mg_schematic.cpp
diff options
context:
space:
mode:
authorlhofhansl <larsh@apache.org>2021-08-31 17:32:31 -0700
committerGitHub <noreply@github.com>2021-08-31 17:32:31 -0700
commitd1624a552151bcb152b7abf63df6501b63458d78 (patch)
treee73a7b216f23962c06e591c4d0d1e5333d949b08 /src/mapgen/mg_schematic.cpp
parentbeac4a2c984706b636e7b1e03406e05c87435903 (diff)
downloadminetest-d1624a552151bcb152b7abf63df6501b63458d78.tar.gz
minetest-d1624a552151bcb152b7abf63df6501b63458d78.tar.bz2
minetest-d1624a552151bcb152b7abf63df6501b63458d78.zip
Switch MapBlock compression to zstd (#10788)
* Add zstd support. * Rearrange serialization order * Compress entire mapblock Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'src/mapgen/mg_schematic.cpp')
-rw-r--r--src/mapgen/mg_schematic.cpp9
1 files changed, 6 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;
}