OpenTTD Source 20260721-master-g25ec12c62d
NewGRFMappingChunkHandler Struct Reference

Chunk handler for data of the OverrideManagerBase. More...

#include <newgrf_sl.h>

Inheritance diagram for NewGRFMappingChunkHandler:
ChunkHandler APIDChunkHandler ATIDChunkHandler HIDSChunkHandler IIDSChunkHandler OBIDChunkHandler TIDSChunkHandler

Public Member Functions

 NewGRFMappingChunkHandler (ChunkId id, OverrideManagerBase &mapping)
 Create the handler.
void Save () const override
 Save a GRF ID + local id -> OpenTTD's id mapping.
void Load () const override
 Load a GRF ID + local id -> OpenTTD's id mapping.
Public Member Functions inherited from ChunkHandler
 ChunkHandler (ChunkId id, ChunkType type)
 Create this ChunkHandler.
virtual ~ChunkHandler ()=default
 Ensure the destructor of the sub classes are called as well.
virtual void FixPointers () const
 Fix the pointers.
virtual void LoadCheck (size_t len=0) const
 Load the chunk for game preview.
std::string GetName () const
 Get the name of this chunk.

Data Fields

OverrideManagerBasemapping
 The override manager to save/load.
Data Fields inherited from ChunkHandler
ChunkId id
 Unique ID (4 letters).
ChunkType type
 Type of the chunk.

Detailed Description

Chunk handler for data of the OverrideManagerBase.

Definition at line 17 of file newgrf_sl.h.

Constructor & Destructor Documentation

◆ NewGRFMappingChunkHandler()

NewGRFMappingChunkHandler::NewGRFMappingChunkHandler ( ChunkId id,
OverrideManagerBase & mapping )
inline

Create the handler.

Parameters
idThe identifier of the chunk
mappingThe override manager to save/load.

Definition at line 25 of file newgrf_sl.h.

References ChunkHandler::ChunkHandler(), ChunkHandler::id, and mapping.

Member Function Documentation

◆ Load()

void NewGRFMappingChunkHandler::Load ( ) const
overridevirtual

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

Implements ChunkHandler.

Definition at line 47 of file newgrf_sl.cpp.

References _newgrf_mapping_desc, _newgrf_mapping_sl_compat, mapping, SlCompatTableHeader(), SlErrorCorrupt(), SlIterateArray(), and SlObject().

◆ Save()

void NewGRFMappingChunkHandler::Save ( ) const
overridevirtual

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

Reimplemented from ChunkHandler.

Definition at line 32 of file newgrf_sl.cpp.

References _newgrf_mapping_desc, mapping, SlObject(), and SlTableHeader().

Field Documentation

◆ mapping

OverrideManagerBase& NewGRFMappingChunkHandler::mapping

The override manager to save/load.

Definition at line 18 of file newgrf_sl.h.

Referenced by Load(), NewGRFMappingChunkHandler(), and Save().


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