OpenTTD Source 20241224-master-gf74b0cf984
|
Declarations of strctures and function used in loader of old savegames. More...
Go to the source code of this file.
Data Structures | |
struct | LoadgameState |
struct | OldChunks |
Macros | |
#define | OCL_SVAR(type, base, offset) { type, 1, nullptr, [] (void *b) -> void * { return std::addressof(static_cast<base *>(b)->offset); }, nullptr } |
#define | OCL_VAR(type, amount, pointer) { type, amount, pointer, nullptr, nullptr } |
#define | OCL_END() { OC_END, 0, nullptr, nullptr, nullptr } |
#define | OCL_CNULL(type, amount) { OC_NULL | type, amount, nullptr, nullptr, nullptr } |
#define | OCL_CCHUNK(type, amount, proc) { OC_CHUNK | type, amount, nullptr, nullptr, proc } |
#define | OCL_ASSERT(type, size) { OC_ASSERT | type, 1, (void *)(size_t)size, nullptr, nullptr } |
#define | OCL_NULL(amount) OCL_CNULL((OldChunkType)0, amount) |
#define | OCL_CHUNK(amount, proc) OCL_CCHUNK((OldChunkType)0, amount, proc) |
Typedefs | |
typedef bool | OldChunkProc(LoadgameState *ls, int num) |
typedef void * | OffsetProc(void *base) |
Enumerations | |
enum | OldChunkType { OC_SIMPLE = 0 , OC_NULL = 1 , OC_CHUNK = 2 , OC_ASSERT = 3 , OC_TTD = 1 << 4 , OC_TTO = 1 << 5 , OC_VAR_I8 = 1 << 8 , OC_VAR_U8 = 2 << 8 , OC_VAR_I16 = 3 << 8 , OC_VAR_U16 = 4 << 8 , OC_VAR_I32 = 5 << 8 , OC_VAR_U32 = 6 << 8 , OC_VAR_I64 = 7 << 8 , OC_VAR_U64 = 8 << 8 , OC_FILE_I8 = 1 << 16 , OC_FILE_U8 = 2 << 16 , OC_FILE_I16 = 3 << 16 , OC_FILE_U16 = 4 << 16 , OC_FILE_I32 = 5 << 16 , OC_FILE_U32 = 6 << 16 , OC_INT8 = OC_VAR_I8 | OC_FILE_I8 , OC_UINT8 = OC_VAR_U8 | OC_FILE_U8 , OC_INT16 = OC_VAR_I16 | OC_FILE_I16 , OC_UINT16 = OC_VAR_U16 | OC_FILE_U16 , OC_INT32 = OC_VAR_I32 | OC_FILE_I32 , OC_UINT32 = OC_VAR_U32 | OC_FILE_U32 , OC_TILE = OC_VAR_U32 | OC_FILE_U16 , OC_DEREFERENCE_POINTER = 1 << 31 , OC_END = 0 } |
Functions | |
uint8_t | ReadByte (LoadgameState *ls) |
Reads a byte from the buffer and decompress if needed. | |
bool | LoadChunk (LoadgameState *ls, void *base, const OldChunks *chunks) |
Loads a chunk from the old savegame. | |
bool | LoadTTDMain (LoadgameState *ls) |
bool | LoadTTOMain (LoadgameState *ls) |
uint16_t | ReadUint16 (LoadgameState *ls) |
uint32_t | ReadUint32 (LoadgameState *ls) |
Variables | |
static const uint | BUFFER_SIZE = 4096 |
static const uint | OLD_MAP_SIZE = 256 |
uint | _bump_assert_value |
Declarations of strctures and function used in loader of old savegames.
Definition in file oldloader.h.
#define OCL_ASSERT | ( | type, | |
size | |||
) | { OC_ASSERT | type, 1, (void *)(size_t)size, nullptr, nullptr } |
Definition at line 129 of file oldloader.h.
#define OCL_CCHUNK | ( | type, | |
amount, | |||
proc | |||
) | { OC_CHUNK | type, amount, nullptr, nullptr, proc } |
Definition at line 128 of file oldloader.h.
#define OCL_CHUNK | ( | amount, | |
proc | |||
) | OCL_CCHUNK((OldChunkType)0, amount, proc) |
Definition at line 131 of file oldloader.h.
#define OCL_CNULL | ( | type, | |
amount | |||
) | { OC_NULL | type, amount, nullptr, nullptr, nullptr } |
Definition at line 127 of file oldloader.h.
#define OCL_END | ( | ) | { OC_END, 0, nullptr, nullptr, nullptr } |
Definition at line 126 of file oldloader.h.
#define OCL_NULL | ( | amount | ) | OCL_CNULL((OldChunkType)0, amount) |
Definition at line 130 of file oldloader.h.
#define OCL_SVAR | ( | type, | |
base, | |||
offset | |||
) | { type, 1, nullptr, [] (void *b) -> void * { return std::addressof(static_cast<base *>(b)->offset); }, nullptr } |
Definition at line 124 of file oldloader.h.
#define OCL_VAR | ( | type, | |
amount, | |||
pointer | |||
) | { type, amount, pointer, nullptr, nullptr } |
Definition at line 125 of file oldloader.h.
typedef void * OffsetProc(void *base) |
Definition at line 85 of file oldloader.h.
typedef bool OldChunkProc(LoadgameState *ls, int num) |
Definition at line 84 of file oldloader.h.
enum OldChunkType |
Definition at line 35 of file oldloader.h.
bool LoadChunk | ( | LoadgameState * | ls, |
void * | base, | ||
const OldChunks * | chunks | ||
) |
Loads a chunk from the old savegame.
Definition at line 122 of file oldloader.cpp.
References _savegame_type, CalcOldVarLen(), Debug, GB(), OC_DEREFERENCE_POINTER, OC_END, OC_TTD, OC_TTO, ReadByte(), SGT_TTO, and OldChunks::type.
bool LoadTTDMain | ( | LoadgameState * | ls | ) |
Definition at line 1771 of file oldloader_sl.cpp.
bool LoadTTOMain | ( | LoadgameState * | ls | ) |
Definition at line 1813 of file oldloader_sl.cpp.
uint8_t ReadByte | ( | LoadgameState * | ls | ) |
Reads a byte from the buffer and decompress if needed.
Definition at line 88 of file oldloader.cpp.
References ReadByteFromFile().
Referenced by LoadChunk().
|
inline |
Definition at line 103 of file oldloader.h.
|
inline |
Definition at line 109 of file oldloader.h.
|
extern |
Definition at line 30 of file oldloader.cpp.
|
static |
Definition at line 16 of file oldloader.h.
|
static |
Definition at line 17 of file oldloader.h.