OpenTTD Source: ChunkHandler Struct Reference

OpenTTD Source 15.0-beta1

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.
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()

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

Load the chunk.

Must be overridden.

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

Referenced by SlLoadChunk().

## ◆ 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, 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()

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

Save the chunk.

Must be overridden, unless Chunk type is CH_READONLY.

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

Definition at line 475 of file saveload.h.

Referenced by SlSaveChunk().

## 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:

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