OpenTTD Source: src/saveload/oldloader.cpp File Reference

OpenTTD Source 14.0-beta1

Typedefs | Functions | Variables
oldloader.cpp File Reference
`#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 "../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()) More...
byte | ReadByte (LoadgameState *ls)
| Reads a byte from the buffer and decompress if needed. More...
bool | LoadChunk (LoadgameState *ls, void *base, const OldChunks *chunks)
| Loads a chunk from the old savegame. More...
static void | InitLoading (LoadgameState *ls)
| Initialize some data before reading. More...
static bool | VerifyOldNameChecksum (char *title, uint len)
| Verifies the title has a valid checksum. More...
static std::tuple< SavegameType, std::string > | DetermineOldSavegameTypeAndName (FILE *f)
bool | LoadOldSaveGame (const std::string &file)
std::string | GetOldSaveGameName (const std::string &file)

## Variables
static const int | TTO_HEADER_SIZE = 41
static const int | TTD_HEADER_SIZE = 49
static const int | HEADER_CHECKSUM_SIZE = 2
| The size of the checksum in the name/header of the TTD/TTO savegames.
uint32_t | _bump_assert_value

## Detailed Description

Functions for handling of TTO/TTD/TTDP savegames.

Definition in file oldloader.cpp.

## Function Documentation

## ◆ InitLoading()

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

Initialize some data before reading.

Definition at line 187 of file oldloader.cpp.

## ◆ LoadChunk()

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

Loads a chunk from the old savegame.

Definition at line 110 of file oldloader.cpp.

References _savegame_type, OC_DEREFERENCE_POINTER, OC_END, OC_TTD, OC_TTO, SGT_TTO, and OldChunks::type.

## ◆ ReadByte()

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

Reads a byte from the buffer and decompress if needed.

Definition at line 76 of file oldloader.cpp.

References ReadByteFromFile().

## ◆ ReadByteFromFile()

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

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

Definition at line 49 of file oldloader.cpp.

Referenced by ReadByte().

## ◆ VerifyOldNameChecksum()

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

Definition at line 210 of file oldloader.cpp.