OpenTTD Source  20241108-master-g80f628063a
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. More...
 
virtual void Load () const =0
 Load the chunk. More...
 
virtual void FixPointers () const
 Fix the pointers. More...
 
virtual void LoadCheck (size_t len=0) const
 Load the chunk for game preview. More...
 
std::string GetName () const
 

Data Fields

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

Detailed Description

Handlers and description of chunk.

Definition at line 459 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 CHKPChunkHandler, VEHSChunkHandler, CITYChunkHandler, ROADChunkHandler, STNNChunkHandler, STNSChunkHandler, BKORChunkHandler, ORDLChunkHandler, ORDRChunkHandler, OBJSChunkHandler, LGRSChunkHandler, INDYChunkHandler, CAPYChunkHandler, DEPTChunkHandler, PLYRChunkHandler, and ERNWChunkHandler.

Definition at line 485 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 PATSChunkHandler, NGRFChunkHandler, DATEChunkHandler, MAPSChunkHandler, GLOGChunkHandler, and PLYRChunkHandler.

Definition at line 1976 of file saveload.cpp.

References _sl, and SaveLoadParams::block_mode.

◆ Save()

Field Documentation

◆ type

ChunkType ChunkHandler::type

Type of the chunk.

See also
ChunkType

Definition at line 461 of file saveload.h.

Referenced by SlSaveChunk().


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