OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
18 #include "../safeguards.h"
34 for (uint i = 0; i < this->mapping.GetMaxMapping(); i++) {
36 this->mapping.mapping_ID[i].entity_id == 0)
continue;
53 uint max_id = this->mapping.GetMaxMapping();
57 if ((uint)index >= max_id)
SlErrorCorrupt(
"Too many NewGRF entity mappings");
63 static const SaveLoad _grfconfig_desc[] = {
85 SlSetArrayIndex(index++);
91 void LoadCommon(
GRFConfig *&grfconfig)
const
108 if (_game_mode == GM_MENU) {
void SetSuitablePalette()
Set the palette of this GRFConfig to something suitable.
void ClearGRFConfigList(GRFConfig **config)
Clear a GRF Config list, freeing all nodes.
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
void Load() const override
Load the chunk.
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.
const SaveLoadCompat _newgrf_mapping_sl_compat[]
Original field order for _newgrf_mapping_desc.
void Save() const override
Save the chunk.
Handlers and description of chunk.
#define SLE_ARR(base, variable, type, length)
Storage of fixed-size array of SL_VAR elements in every version of a savegame.
uint32 grfid
The GRF ID of the file the entity belongs to.
Information about GRF, used in the game and (part of it) in savegames.
A trimmed down version of what std::span will be in C++20.
void ResetMapping()
Resets the mapping, which is used while initializing game.
void Load() const override
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.
Maps an entity id stored on the map to a GRF file.
void Save() const override
Save a GRF ID + local id -> OpenTTD's id mapping.
const SaveLoadCompat _grfconfig_sl_compat[]
Original field order for _newgrf_desc.
@ 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.
void LoadCheck(size_t) const override
Load the chunk for game preview.
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.
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
void ResetGRFConfig(bool defaults)
Reset the current GRF Config to either blank or newgame settings.
void SlObject(void *object, const SaveLoadTable &slt)
Main SaveLoad function.
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
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)