2 (c) 2010 Perttu Ahola <celeron55@gmail.com>
5 #ifndef SERIALIZATION_HEADER
6 #define SERIALIZATION_HEADER
8 #include "common_irrlicht.h"
9 #include "exceptions.h"
14 NOTE: The goal is to increment this so that saved maps will be
15 loadable by any version. Other compatibility is not
17 Serialization format versions:
19 0: original networked test with 1-byte nodes
20 1: update with 2-byte nodes
22 2: lighting is transmitted in param
23 3: optional fetching of far blocks
25 5: sector objects NOTE: block compression was left accidentally out
26 6: failed attempt at switching block compression on again
27 7: block compression switched on again
28 8: (dev) server-initiated block transfers and all kinds of stuff
29 9: (dev) block objects
31 // This represents an uninitialized or invalid format
32 #define SER_FMT_VER_INVALID 255
33 // Highest supported serialization version
34 #define SER_FMT_VER_HIGHEST 9
35 // Lowest supported serialization version
36 #define SER_FMT_VER_LOWEST 2
38 #define ser_ver_supported(v) (v >= SER_FMT_VER_LOWEST && v <= SER_FMT_VER_HIGHEST)
40 void compress(SharedBuffer<u8> data, std::ostream &os, u8 version);
41 void decompress(std::istream &is, std::ostream &os, u8 version);
46 void serialize(std::ostream &os, u8 version) = 0;
47 void deSerialize(std::istream &istr);