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

OpenTTD Source 1.11.0-RC1

Functions | Variables
newgrf_sl.cpp File Reference
`#include "../stdafx.h"`
`#include "../fios.h"`
`#include "saveload.h"`
`#include "newgrf_sl.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Functions
void | Save_NewGRFMapping (const OverrideManagerBase &mapping)
| Save a GRF ID + local id -> OpenTTD's id mapping. More...
void | Load_NewGRFMapping (OverrideManagerBase &mapping)
| Load a GRF ID + local id -> OpenTTD's id mapping. More...
static void | Save_NGRF ()
static void | Load_NGRF_common (GRFConfig *&grfconfig)
static void | Load_NGRF ()
static void | Check_NGRF ()

## Variables
static const SaveLoad | _newgrf_mapping_desc []
| Save and load the mapping between a spec and the NewGRF it came from. More...
static const SaveLoad | _grfconfig_desc []
const ChunkHandler | _newgrf_chunk_handlers []

## Detailed Description

Code handling saving and loading of newgrf config

Definition in file newgrf_sl.cpp.

## Function Documentation

## ◆ Load_NewGRFMapping()

void Load_NewGRFMapping | ( | OverrideManagerBase & | mapping | ) |

Load a GRF ID + local id -> OpenTTD's id mapping.

Parameters

  mapping | The mapping to load.

Definition at line 42 of file newgrf_sl.cpp.

References _newgrf_mapping_desc, OverrideManagerBase::mapping_ID, OverrideManagerBase::ResetMapping(), SlErrorCorrupt(), SlIterateArray(), and SlObject().

## ◆ Save_NewGRFMapping()

void Save_NewGRFMapping | ( | const OverrideManagerBase & | mapping | ) |

Save a GRF ID + local id -> OpenTTD's id mapping.

Parameters

  mapping | The mapping to save.

Definition at line 30 of file newgrf_sl.cpp.

## Variable Documentation

## ◆ _grfconfig_desc

const SaveLoad _grfconfig_desc[]
| static

Initial value:
= {
SLE_STR(GRFConfig, filename, SLE_STR, 0x40),
SLE_VAR(GRFConfig, ident.grfid, SLE_UINT32),
SLE_ARR(GRFConfig, ident.md5sum, SLE_UINT8, 16),
SLE_CONDVAR(GRFConfig, version, SLE_UINT32, SLV_151, SL_MAX_VERSION),
SLE_ARR(GRFConfig, param, SLE_UINT32, 0x80),
SLE_VAR(GRFConfig, num_params, SLE_UINT8),
SLE_CONDVAR(GRFConfig, palette, SLE_UINT8, SLV_101, SL_MAX_VERSION),
}

Definition at line 58 of file newgrf_sl.cpp.

## ◆ _newgrf_chunk_handlers

const ChunkHandler _newgrf_chunk_handlers[]

Initial value:
= {
{ 'NGRF', Save_NGRF, Load_NGRF, nullptr, Check_NGRF, CH_ARRAY | CH_LAST }
}

## ◆ _newgrf_mapping_desc

const SaveLoad _newgrf_mapping_desc[]
| static

Initial value:
= {
SLE_VAR(EntityIDMapping, grfid, SLE_UINT32),
SLE_VAR(EntityIDMapping, entity_id, SLE_UINT8),
SLE_VAR(EntityIDMapping, substitute_id, SLE_UINT8),
}

Save and load the mapping between a spec and the NewGRF it came from.

Definition at line 19 of file newgrf_sl.cpp.

Referenced by Load_NewGRFMapping().

SLE_CONDVAR
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
Definition: saveload.h:551
SLE_STR
#define SLE_STR(base, variable, type, length)
Storage of a string in every savegame version.
Definition: saveload.h:647
CH_LAST
@ CH_LAST
Last chunk in this array.
Definition: saveload.h:410
SLE_ARR
#define SLE_ARR(base, variable, type, length)
Storage of an array in every version of a savegame.
Definition: saveload.h:638
GRFConfig
Information about GRF, used in the game and (part of it) in savegames.
Definition: newgrf_config.h:152
EntityIDMapping
Maps an entity id stored on the map to a GRF file.
Definition: newgrf_commons.h:186
SL_MAX_VERSION
@ SL_MAX_VERSION
Highest possible saveload version.
Definition: saveload.h:328
SLE_VAR
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
Definition: saveload.h:621
SLV_101
@ SLV_101
101 14233
Definition: saveload.h:164
SLV_151
@ SLV_151
151 20918
Definition: saveload.h:224