OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
16 #include "../safeguards.h"
32 for (uint i = 0; i < mapping.GetMaxMapping(); i++) {
48 uint max_id = mapping.GetMaxMapping();
52 if ((uint)index >= max_id)
SlErrorCorrupt(
"Too many NewGRF entity mappings");
58 static const SaveLoad _grfconfig_desc[] = {
70 static void Save_NGRF()
76 SlSetArrayIndex(index++);
82 static void Load_NGRF_common(
GRFConfig *&grfconfig)
93 static void Load_NGRF()
97 if (_game_mode == GM_MENU) {
109 static void Check_NGRF()
115 {
'NGRF', Save_NGRF, Load_NGRF,
nullptr, Check_NGRF, CH_ARRAY |
CH_LAST }
void SetSuitablePalette()
Set the palette of this GRFConfig to something suitable.
void ClearGRFConfigList(GRFConfig **config)
Clear a GRF Config list, freeing all nodes.
LoadCheckData _load_check_data
Data loaded from save during SL_LOAD_CHECK.
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
#define SLE_STR(base, variable, type, length)
Storage of a string in every savegame version.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
GRFConfig * grfconfig
NewGrf configuration from save.
@ CH_LAST
Last chunk in this array.
Handlers and description of chunk.
#define SLE_ARR(base, variable, type, length)
Storage of an array in every version of a savegame.
Information about GRF, used in the game and (part of it) in savegames.
void ResetMapping()
Resets the mapping, which is used while initializing game.
#define SLE_END()
End marker of a struct/class save or load.
void Load_NewGRFMapping(OverrideManagerBase &mapping)
Load a GRF ID + local id -> OpenTTD's id mapping.
static bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor=0)
Checks whether the savegame is below major.
void SlObject(void *object, const SaveLoad *sld)
Main SaveLoad function.
Maps an entity id stored on the map to a GRF file.
@ SL_MAX_VERSION
Highest possible saveload version.
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
void AppendStaticGRFConfigs(GRFConfig **dst)
Appends the static GRFs to a list of GRFs.
void NORETURN SlErrorCorrupt(const char *msg)
Error handler for corrupt savegames.
struct GRFConfig * next
NOSAVE: Next item in the linked list.
static const SaveLoad _newgrf_mapping_desc[]
Save and load the mapping between a spec and the NewGRF it came from.
EntityIDMapping * mapping_ID
mapping of ids from grf files. Public out of convenience
GRFConfig * _grfconfig
First item in list of current GRF set up.
void ResetGRFConfig(bool defaults)
Reset the current GRF Config to either blank or newgame settings.
void AppendToGRFConfigList(GRFConfig **dst, GRFConfig *el)
Appends an element to a list of GRFs.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
@ GCF_STATIC
GRF file is used statically (can be used in any MP game)
void Save_NewGRFMapping(const OverrideManagerBase &mapping)
Save a GRF ID + local id -> OpenTTD's id mapping.