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