OpenTTD Source 20241224-master-gf74b0cf984
NGRFChunkHandler Struct Reference
Inheritance diagram for NGRFChunkHandler:
ChunkHandler

Public Member Functions

void SaveParameters (const GRFConfig &config) const
 
void Save () const override
 Save the chunk.
 
void LoadParameters (GRFConfig &config) const
 
void LoadCommon (GRFConfig *&grfconfig) const
 
void Load () const override
 Load the chunk.
 
void LoadCheck (size_t) const override
 Load the chunk for game preview.
 
- Public Member Functions inherited from ChunkHandler
 ChunkHandler (uint32_t id, ChunkType type)
 
virtual void FixPointers () const
 Fix the pointers.
 
std::string GetName () const
 

Static Public Attributes

static std::array< uint32_t, GRFConfig::MAX_NUM_PARAMS > param
 
static uint8_t num_params
 
static const SaveLoad description []
 

Additional Inherited Members

- Data Fields inherited from ChunkHandler
uint32_t id
 Unique ID (4 letters).
 
ChunkType type
 Type of the chunk.
 

Detailed Description

Definition at line 64 of file newgrf_sl.cpp.

Constructor & Destructor Documentation

◆ NGRFChunkHandler()

NGRFChunkHandler::NGRFChunkHandler ( )
inline

Definition at line 65 of file newgrf_sl.cpp.

Member Function Documentation

◆ Load()

void NGRFChunkHandler::Load ( ) const
inlineoverridevirtual

Load the chunk.

Must be overridden.

Implements ChunkHandler.

Definition at line 123 of file newgrf_sl.cpp.

References _grfconfig, AppendStaticGRFConfigs(), ResetGRFConfig(), and SlErrorCorrupt().

◆ LoadCheck()

void NGRFChunkHandler::LoadCheck ( size_t  len) const
inlineoverridevirtual

Load the chunk for game preview.

Default implementation just skips the data.

Parameters
lenNumber of bytes to skip.

Reimplemented from ChunkHandler.

Definition at line 139 of file newgrf_sl.cpp.

References _load_check_data, and LoadCheckData::grfconfig.

◆ LoadCommon()

void NGRFChunkHandler::LoadCommon ( GRFConfig *&  grfconfig) const
inline

Definition at line 109 of file newgrf_sl.cpp.

◆ LoadParameters()

void NGRFChunkHandler::LoadParameters ( GRFConfig config) const
inline

Definition at line 102 of file newgrf_sl.cpp.

◆ Save()

void NGRFChunkHandler::Save ( ) const
inlineoverridevirtual

Save the chunk.

Must be overridden, unless Chunk type is CH_READONLY.

Reimplemented from ChunkHandler.

Definition at line 88 of file newgrf_sl.cpp.

References _grfconfig, GCF_INIT_ONLY, GCF_STATIC, HasBit(), GRFConfig::next, SlObject(), and SlTableHeader().

◆ SaveParameters()

void NGRFChunkHandler::SaveParameters ( const GRFConfig config) const
inline

Definition at line 80 of file newgrf_sl.cpp.

Field Documentation

◆ description

const SaveLoad NGRFChunkHandler::description[]
inlinestatic
Initial value:
= {
SLE_SSTR(GRFConfig, filename, SLE_STR),
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),
SLEG_ARR("param", param, SLE_UINT32, std::size(param)),
SLEG_VAR("num_params", num_params, SLE_UINT8),
SLE_CONDVAR(GRFConfig, palette, SLE_UINT8, SLV_101, SL_MAX_VERSION),
}
#define SLE_ARR(base, variable, type, length)
Storage of fixed-size array of SL_VAR elements in every version of a savegame.
Definition saveload.h:1028
#define SLEG_VAR(name, variable, type)
Storage of a global variable in every savegame version.
Definition saveload.h:1186
#define SLEG_ARR(name, variable, type, length)
Storage of a global fixed-size array of SL_VAR elements in every savegame version.
Definition saveload.h:1203
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
Definition saveload.h:868
#define SLE_SSTR(base, variable, type)
Storage of a std::string in every savegame version.
Definition saveload.h:1046
@ SL_MAX_VERSION
Highest possible saveload version.
Definition saveload.h:399
@ SLV_151
151 20918
Definition saveload.h:224
@ SLV_101
101 14233
Definition saveload.h:164
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
Definition saveload.h:1002
Information about GRF, used in the game and (part of it) in savegames.

Definition at line 70 of file newgrf_sl.cpp.

◆ num_params

uint8_t NGRFChunkHandler::num_params
inlinestatic

Definition at line 68 of file newgrf_sl.cpp.

◆ param

std::array<uint32_t, GRFConfig::MAX_NUM_PARAMS> NGRFChunkHandler::param
inlinestatic

Definition at line 67 of file newgrf_sl.cpp.


The documentation for this struct was generated from the following file: