OpenTTD Source: ChunkHandler Struct Reference

OpenTTD Source 14.1

Public Member Functions | Data Fields
ChunkHandler Struct Referenceabstract

Handlers and description of chunk. More...

`#include <saveload.h>`

Inheritance diagram for ChunkHandler:

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

Definition at line 471 of file saveload.h.

## ◆ Load()

virtual void ChunkHandler::Load | ( |  | ) | const
| pure virtual

Load the chunk.

Must be overridden.

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

## ◆ LoadCheck()

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

Load the chunk for game preview.

Default implementation just skips the data.

Parameters

  len | Number of bytes to skip.

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

Definition at line 1940 of file saveload.cpp.

References _sl, and SaveLoadParams::block_mode.

## ◆ Save()

virtual void ChunkHandler::Save | ( |  | ) | const
| inlinevirtual

Save the chunk.

Must be overridden, unless Chunk type is CH_READONLY.

Reimplemented in VEHSChunkHandler, ROADChunkHandler, STNNChunkHandler, PLYRChunkHandler, GLOGChunkHandler, MAP8ChunkHandler, LGRSChunkHandler, MAP7ChunkHandler, ITBLChunkHandler, LGRJChunkHandler, MAPEChunkHandler, CITYChunkHandler, IBLDChunkHandler, BKORChunkHandler, LGRPChunkHandler, MAP5ChunkHandler, M3HIChunkHandler, ORDLChunkHandler, PATSChunkHandler, INDYChunkHandler, M3LOChunkHandler, EIDSChunkHandler, GSTRChunkHandler, MAP2ChunkHandler, VIEWChunkHandler, AIPLChunkHandler, CAPAChunkHandler, MAPOChunkHandler, ORDRChunkHandler, DATEChunkHandler, MAPHChunkHandler, GSDTChunkHandler, RAILChunkHandler, CMPUChunkHandler, CAPYChunkHandler, STPAChunkHandler, ENGNChunkHandler, MAPTChunkHandler, NGRFChunkHandler, ECMYChunkHandler, LEATChunkHandler, CMDLChunkHandler, CHTSChunkHandler, STPEChunkHandler, PSACChunkHandler, SIGNChunkHandler, DEPTChunkHandler, OBJSChunkHandler, SUBSChunkHandler, GRPSChunkHandler, LEAEChunkHandler, MAPSChunkHandler, ERNWChunkHandler, GOALChunkHandler, ANITChunkHandler, SRNDChunkHandler, and NewGRFMappingChunkHandler.

Definition at line 457 of file saveload.h.

## Field Documentation

## ◆ type

ChunkType ChunkHandler::type

Type of the chunk.

See also
  ChunkType

Definition at line 447 of file saveload.h.

Referenced by SlSaveChunk().

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

- src/saveload/saveload.h
- src/saveload/saveload.cpp