OpenTTD Source 20241224-master-gf74b0cf984
ChunkHandler Struct Referenceabstract

Handlers and description of chunk. More...

#include <saveload.h>

Inheritance diagram for ChunkHandler:
AIPLChunkHandler ANITChunkHandler BKORChunkHandler CAPAChunkHandler CAPRChunkHandler CAPYChunkHandler CHKPChunkHandler CHTSChunkHandler CITYChunkHandler CMDLChunkHandler CMPUChunkHandler DATEChunkHandler DEPTChunkHandler ECMYChunkHandler EIDSChunkHandler ENGNChunkHandler ENGSChunkHandler ERNWChunkHandler GLOGChunkHandler GOALChunkHandler GRPSChunkHandler GSDTChunkHandler GSTRChunkHandler IBLDChunkHandler INDYChunkHandler ITBLChunkHandler LEAEChunkHandler LEATChunkHandler LGRJChunkHandler LGRPChunkHandler LGRSChunkHandler M3HIChunkHandler M3LOChunkHandler MAP2ChunkHandler MAP5ChunkHandler MAP7ChunkHandler MAP8ChunkHandler MAPEChunkHandler MAPHChunkHandler MAPOChunkHandler MAPSChunkHandler MAPTChunkHandler NAMEChunkHandler NGRFChunkHandler NewGRFMappingChunkHandler OBJSChunkHandler OPTSChunkHandler ORDLChunkHandler ORDRChunkHandler PATSChunkHandler PLYRChunkHandler PRICChunkHandler PSACChunkHandler RAILChunkHandler ROADChunkHandler ROTTChunkHandler SIGNChunkHandler SRNDChunkHandler STNNChunkHandler STNSChunkHandler STPAChunkHandler STPEChunkHandler SUBSChunkHandler VEHSChunkHandler VIEWChunkHandler WaterRegionChunkHandler

Public Member Functions

 ChunkHandler (uint32_t id, ChunkType type)
 
virtual void Save () const
 Save the chunk.
 
virtual void Load () const =0
 Load the chunk.
 
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
 

Data Fields

uint32_t id
 Unique ID (4 letters).
 
ChunkType type
 Type of the chunk.
 

Detailed Description

Handlers and description of chunk.

Definition at line 463 of file saveload.h.

Constructor & Destructor Documentation

◆ ChunkHandler()

ChunkHandler::ChunkHandler ( uint32_t  id,
ChunkType  type 
)
inline

Definition at line 467 of file saveload.h.

Member Function Documentation

◆ FixPointers()

virtual void ChunkHandler::FixPointers ( ) const
inlinevirtual

Fix the pointers.

Pointers are saved using the index of the pointed object. On load, pointers are filled with indices and need to be fixed to point to the real object. Must be overridden if the chunk saves any pointer.

Reimplemented in ERNWChunkHandler, PLYRChunkHandler, DEPTChunkHandler, CAPYChunkHandler, INDYChunkHandler, LGRSChunkHandler, OBJSChunkHandler, ORDRChunkHandler, ORDLChunkHandler, BKORChunkHandler, STNSChunkHandler, STNNChunkHandler, ROADChunkHandler, CITYChunkHandler, VEHSChunkHandler, and CHKPChunkHandler.

Definition at line 489 of file saveload.h.

◆ GetName()

std::string ChunkHandler::GetName ( ) const
inline

Definition at line 498 of file saveload.h.

◆ Load()

◆ LoadCheck()

void ChunkHandler::LoadCheck ( size_t  len = 0) const
virtual

Load the chunk for game preview.

Default implementation just skips the data.

Parameters
lenNumber of bytes to skip.

Reimplemented in PLYRChunkHandler, GLOGChunkHandler, MAPSChunkHandler, DATEChunkHandler, NGRFChunkHandler, and PATSChunkHandler.

Definition at line 2012 of file saveload.cpp.

References _sl, SaveLoadParams::block_mode, SlSkipArray(), SlSkipBytes(), and SlTableHeader().

Referenced by SlLoadCheckChunk().

◆ Save()

Field Documentation

◆ id

uint32_t ChunkHandler::id

Unique ID (4 letters).

Definition at line 464 of file saveload.h.

Referenced by SlSaveChunk().

◆ type

ChunkType ChunkHandler::type

Type of the chunk.

See also
ChunkType

Definition at line 465 of file saveload.h.

Referenced by SlSaveChunk().


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