OpenTTD: src/saveload/oldloader.cpp File Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Typedefs | Functions | Variables
oldloader.cpp File Reference

Functions for handling of TTO/TTD/TTDP savegames. More...

`#include "../stdafx.h"`
`#include "../debug.h"`
`#include "../strings_type.h"`
`#include "../string_func.h"`
`#include "../settings_type.h"`
`#include "../fileio_func.h"`
`#include "table/strings.h"`
`#include "saveload_internal.h"`
`#include "oldloader.h"`
`#include <exception>`
`#include "../safeguards.h"`

Go to the source code of this file.

## Typedefs
typedef bool | LoadOldMainProc (LoadgameState *ls)

## Functions
static OldChunkType | GetOldChunkType (OldChunkType type)
static OldChunkType | GetOldChunkVarType (OldChunkType type)
static OldChunkType | GetOldChunkFileType (OldChunkType type)
static byte | CalcOldVarLen (OldChunkType type)
static byte | ReadByteFromFile (LoadgameState *ls)
| Reads a byte from a file (do not call yourself, use ReadByte())
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.
static void | InitLoading (LoadgameState *ls)
| Initialize some data before reading.
static bool | VerifyOldNameChecksum (char *title, uint len)
| Verifies the title has a valid checksum.
static bool | CheckOldSavegameType (FILE *f, char *temp, const char *last, uint len)
static SavegameType | DetermineOldSavegameType (FILE *f, char *title, const char *last)
bool | LoadOldSaveGame (const char *file)
void | GetOldSaveGameName (const char *file, char *title, const char *last)

## Variables
static const int | TTO_HEADER_SIZE = 41
static const int | TTD_HEADER_SIZE = 49
uint32 | _bump_assert_value

## Detailed Description

Functions for handling of TTO/TTD/TTDP savegames.

Definition in file oldloader.cpp.

## Function Documentation

static void InitLoading | ( | LoadgameState * | ls | ) |
| static

Initialize some data before reading.

Definition at line 190 of file oldloader.cpp.

References _settings_game, GameSettings::construction, and ConstructionSettings::freeform_edges.

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

Loads a chunk from the old savegame.

Definition at line 111 of file oldloader.cpp.

References _savegame_type, DEBUG, GB(), OC_DEREFERENCE_POINTER, OC_END, OC_TTD, OC_TTO, ReadByte(), SGT_TTO, and OldChunks::type.

Referenced by LoadOldVehicle().

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

Reads a byte from the buffer and decompress if needed.

Definition at line 77 of file oldloader.cpp.

References ReadByte(), and ReadByteFromFile().

Referenced by LoadChunk(), LoadOldVehicle(), and ReadByte().

static byte ReadByteFromFile | ( | LoadgameState * | ls | ) |
| static

Reads a byte from a file (do not call yourself, use ReadByte())

Definition at line 50 of file oldloader.cpp.

References DEBUG.

Referenced by ReadByte().

static bool VerifyOldNameChecksum | ( | char * | title,
|  | uint | len
| ) |  |
| static

Verifies the title has a valid checksum.

Parameters

  title | title and checksum
  len | the length of the title to read/checksum

Returns
  true iff the title is valid

Note
  the title (incl. checksum) has to be at least 41/49 (HEADER_SIZE) bytes long!

Definition at line 214 of file oldloader.cpp.

References ROL(), and SB().