ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 80 00 00 00 80 08 06 00 00 00 c3 3e 61 | .PNG........IHDR..............>a |
0020 | cb 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0b 13 00 | .....bKGD..............pHYs..... |
0040 | 00 0b 13 01 00 9a 9c 18 00 00 00 07 74 49 4d 45 07 e1 03 0c 12 1a 35 e5 86 ee 09 00 00 1b bc 49 | ............tIME......5........I |
0060 | 44 41 54 78 da ed 9d 4b 6f 23 cb 92 df 7f 99 59 2f 92 22 29 b5 d4 3a dd be 77 ee b9 0b bf 00 2f | DATx...Ko#.....Y/.")..:..w...../ |
0080 | bc b4 f7 06 e6 1b 0c 30 c0 ec bc 36 e0 6f e2 95 d7 de 78 ef 0f 60 c0 1f c2 ab 8b c1 18 17 f6 e9 | .......0...6.o....x..`.......... |
00a0 | 73 fa a9 27 5f f5 cc 4c 2f 22 4b a5 96 28 92 d2 f5 b4 48 a3 12 38 38 ec 64 55 29 8b 99 19 19 f1 | s..'_..L/"K..(....H..88.dU)..... |
00c0 | 8f f8 47 28 9e 68 7f fb cf 52 5f 5b 85 6f 1a 8c 06 8b 47 03 51 1c 71 bf ff 3f fe d7 ff f1 d4 23 | ..G(.h...R_[.o....G.Q.q..?.....# |
00e0 | f8 4f 7f f7 ef 36 de fb b0 df 55 0d 18 50 de 63 14 58 1d 81 b5 cf 7a c6 ba fe ff f0 5f fe 3b 9b | .O...6....U/*
Minetest-c55
Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef SERIALIZATION_HEADER
#define SERIALIZATION_HEADER
#include "irrlichttypes.h"
#include "exceptions.h"
#include <iostream>
#include "util/pointer.h"
/*
Map format serialization version
--------------------------------
For map data (blocks, nodes, sectors).
NOTE: The goal is to increment this so that saved maps will be
loadable by any version. Other compatibility is not
maintained.
0: original networked test with 1-byte nodes
1: update with 2-byte nodes
2: lighting is transmitted in param
3: optional fetching of far blocks
4: block compression
5: sector objects NOTE: block compression was left accidentally out
6: failed attempt at switching block compression on again
7: block compression switched on again
8: server-initiated block transfers and all kinds of stuff
9: block objects
10: water pressure
11: zlib'd blocks, block flags
12: UnlimitedHeightmap now uses interpolated areas
13: Mapgen v2
14: NodeMetadata
15: StaticObjects
16: larger maximum size of node metadata, and compression
17: MapBlocks contain timestamp
18: new generator (not really necessary, but it's there)
19: new content type handling
20: many existing content types translated to extended ones
21: dynamic content type allocation
22: minerals removed, facedir & wallmounted changed
23: new node metadata format
24: 16-bit node ids and node timers (never released as stable)
25: Improved node timer format
*/
// This represents an uninitialized or invalid format
#define SER_FMT_VER_INVALID 255
// Highest supported serialization version
#define SER_FMT_VER_HIGHEST 25
// Lowest supported serialization version
#define SER_FMT_VER_LOWEST 0
#define ser_ver_supported(v) (v >= SER_FMT_VER_LOWEST && v <= SER_FMT_VER_HIGHEST)
/*
Misc. serialization functions
*/
void compressZlib(SharedBuffer<u8> data, std::ostream &os);
void compressZlib(const std::string &data, std::ostream &os);
void decompressZlib(std::istream &is, std::ostream &os);
// These choose between zlib and a self-made one according to version
void compress(SharedBuffer<u8> data, std::ostream &os, u8 version);
//void compress(const std::string &data, std::ostream &os, u8 version);
void decompress(std::istream &is, std::ostream &os, u8 version);
#endif
|