OpenTTD Source: SaveLoadHandler Class Reference

OpenTTD Source 14.0-RC3

Public Member Functions | Data Fields
SaveLoadHandler Class Referenceabstract

Handler for saving/loading an object to/from disk. More...

`#include <saveload.h>`

Inheritance diagram for SaveLoadHandler:

## Public Member Functions
virtual void | Save ([[maybe_unused]] void *object) const
| Save the object to disk. More...
virtual void | Load ([[maybe_unused]] void *object) const
| Load the object from disk. More...
virtual void | LoadCheck ([[maybe_unused]] void *object) const
| Similar to load, but used only to validate savegames. More...
virtual void | FixPointers ([[maybe_unused]] void *object) const
| A post-load callback to fix SL_REF integers into pointers. More...
virtual SaveLoadTable | GetDescription () const =0
| Get the description of the fields in the savegame.
virtual SaveLoadCompatTable | GetCompatDescription () const =0
| Get the pre-header description of the fields in the savegame.
SaveLoadTable | GetLoadDescription () const
| Get the description for how to load the chunk. More...

## Data Fields
std::optional< std::vector< SaveLoad > > | load_description

## Detailed Description

Handler for saving/loading an object to/from disk.

Definition at line 503 of file saveload.h.

## Member Function Documentation

## ◆ FixPointers()

virtual void SaveLoadHandler::FixPointers | ( | [[maybe_unused] ] void * | object | ) | const
| inlinevirtual

A post-load callback to fix SL_REF integers into pointers.

Parameters

  object | The object to fix.

Definition at line 531 of file saveload.h.

## ◆ GetLoadDescription()

SaveLoadTable SaveLoadHandler::GetLoadDescription | ( |  | ) | const

Get the description for how to load the chunk.

Depending on the savegame version this can either use the headers in the savegame or fall back to backwards compatibility and uses hard-coded headers.

Definition at line 3248 of file saveload.cpp.

## ◆ Load()

virtual void SaveLoadHandler::Load | ( | [[maybe_unused] ] void * | object | ) | const
| inlinevirtual

Load the object from disk.

Parameters

  object | The object to load.

Definition at line 519 of file saveload.h.

## ◆ LoadCheck()

virtual void SaveLoadHandler::LoadCheck | ( | [[maybe_unused] ] void * | object | ) | const
| inlinevirtual

Similar to load, but used only to validate savegames.

Parameters

  object | The object to load.

Definition at line 525 of file saveload.h.

## ◆ Save()

virtual void SaveLoadHandler::Save | ( | [[maybe_unused] ] void * | object | ) | const
| inlinevirtual

Save the object to disk.

Parameters

  object | The object to store.

Definition at line 513 of file saveload.h.

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

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