14 #include "../tile_type.h" 16 static const uint BUFFER_SIZE = 4096;
17 static const uint OLD_MAP_SIZE = 256 * 256;
29 byte buffer[BUFFER_SIZE];
58 OC_FILE_I16 = 3 << 16,
59 OC_FILE_U16 = 4 << 16,
60 OC_FILE_I32 = 5 << 16,
61 OC_FILE_U32 = 6 << 16,
64 OC_INT8 = OC_VAR_I8 | OC_FILE_I8,
65 OC_UINT8 = OC_VAR_U8 | OC_FILE_U8,
66 OC_INT16 = OC_VAR_I16 | OC_FILE_I16,
67 OC_UINT16 = OC_VAR_U16 | OC_FILE_U16,
68 OC_INT32 = OC_VAR_I32 | OC_FILE_I32,
69 OC_UINT32 = OC_VAR_U32 | OC_FILE_U32,
71 OC_TILE = OC_VAR_U32 | OC_FILE_U16,
98 extern uint _bump_assert_value;
113 uint16 x = ReadUint16(ls);
114 return x | ReadUint16(ls) << 16;
126 #define OCL_SVAR(type, base, offset) { type, 1, nullptr, (uint)cpp_offsetof(base, offset), nullptr } 127 #define OCL_VAR(type, amount, pointer) { type, amount, pointer, 0, nullptr } 128 #define OCL_END() { OC_END, 0, nullptr, 0, nullptr } 129 #define OCL_CNULL(type, amount) { OC_NULL | type, amount, nullptr, 0, nullptr } 130 #define OCL_CCHUNK(type, amount, proc) { OC_CHUNK | type, amount, nullptr, 0, proc } 131 #define OCL_ASSERT(type, size) { OC_ASSERT | type, 1, nullptr, size, nullptr } 132 #define OCL_NULL(amount) OCL_CNULL((OldChunkType)0, amount) 133 #define OCL_CHUNK(amount, proc) OCL_CCHUNK((OldChunkType)0, amount, proc)
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
void * ptr
Pointer where to save the data (may only be set if offset is 0)
-//- TTO (default is neither of these)
chunk is valid ONLY for TTD savegames
OldChunkType type
Type of field.
Functions/types related to saving and loading games.
bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks)
Loads a chunk from the old savegame.
uint offset
Offset from basepointer (may only be set if ptr is nullptr)
uint32 TileIndex
The index/ID of a Tile.
uint32 amount
Amount of fields.
End of the whole chunk, all 32 bits set to zero.
byte ReadByte(LoadgameState *ls)
Reads a byte from the buffer and decompress if needed.
Dereference the pointer once before writing to it, so we do not have to use big static arrays...