# oldloader.h File Reference

Declarations of strctures and function used in loader of old savegames. More...

`#include "saveload.h"`

Go to the source code of this file.

## Data Structures
struct | LoadgameState
struct | OldChunks
## Defines
#define | OCL_SVAR(type, base, offset) { type, 1, NULL, (uint)cpp_offsetof(base, offset), NULL }
#define | OCL_VAR(type, amount, pointer) { type, amount, pointer, 0, NULL }
#define | OCL_END() { OC_END, 0, NULL, 0, NULL }
#define | OCL_CNULL(type, amount) { OC_NULL | type, amount, NULL, 0, NULL }
#define | OCL_CCHUNK(type, amount, proc) { OC_CHUNK | type, amount, NULL, 0, proc }
#define | OCL_ASSERT(type, size) { OC_ASSERT | type, 1, NULL, size, NULL }
#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)
## Enumerations
enum | { BUFFER_SIZE = 4096, OLD_MAP_SIZE = 256 * 256 }
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
| DECLARE_ENUM_AS_BIT_SET (OldChunkType)
| assert_compile (sizeof(TileIndex)==4)
byte | 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)
static uint16 | ReadUint16 (LoadgameState *ls)
static uint32 | ReadUint32 (LoadgameState *ls)
## Variables
uint | _bump_assert_value

## Detailed Description

Declarations of strctures and function used in loader of old savegames.

Definition in file oldloader.h.

## Enumeration Type Documentation

enum OldChunkType

Enumerator:

  OC_TTD | chunk is valid ONLY for TTD savegames
  OC_TTO | -//- TTO (default is neither of these)
  OC_DEREFERENCE_POINTER | Dereference the pointer once before writing to it, so we do not have to use big static arrays.
  OC_END | End of the whole chunk, all 32 bits set to zero.

Definition at line 32 of file oldloader.h.

## Function Documentation

bool LoadChunk | ( | LoadgameState * | ls,
|  | void * | base,
|  | const OldChunks * | chunks |
| ) |  |  |

Loads a chunk from the old savegame.

Definition at line 103 of file oldloader.cpp.

References _savegame_type, GB(), OC_DEREFERENCE_POINTER, OC_END, OC_TTD, OC_TTO, ReadByte(), and SGT_TTO.

byte ReadByte | ( | LoadgameState * | ls | ) |

Reads a byte from the buffer and decompress if needed.

Definition at line 69 of file oldloader.cpp.

References ReadByteFromFile().

Referenced by BmpRead1(), BmpRead24(), BmpRead4(), BmpRead4Rle(), BmpRead8(), BmpRead8Rle(), and LoadChunk().