From 2a0d1a059e556afaeb7f5b72205b26447e23286f Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 11 Dec 2010 18:11:03 +0200 Subject: commit before some radicallish changes to water behavior --- src/mapblock.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/mapblock.cpp') diff --git a/src/mapblock.cpp b/src/mapblock.cpp index a4da657d1..d2c323291 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -696,6 +696,15 @@ bool MapBlock::propagateSunlight(core::map & light_sources) return block_below_is_valid; } +void MapBlock::copyTo(VoxelManipulator &dst) +{ + v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE); + VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1)); + + dst.copyFrom(data, data_area, v3s16(0,0,0), + getPosRelative(), data_size); +} + /* Serialization */ @@ -755,6 +764,17 @@ void MapBlock::serialize(std::ostream &os, u8 version) paramdata[i] = data[i].param; } compress(paramdata, os, version); + + if(version >= 10) + { + // Get and compress pressure + SharedBuffer pressuredata(nodecount); + for(u32 i=0; i= 10) + { + // Uncompress and set pressure data + std::ostringstream os(std::ios_base::binary); + decompress(is, os, version); + std::string s = os.str(); + if(s.size() != nodecount) + throw SerializationError + ("MapBlock::deSerialize: invalid format"); + for(u32 i=0; i