OpenTTD Source  20241121-master-g67a0fccfad
SaveLoadHandler Class Referenceabstract

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

#include <saveload.h>

Inheritance diagram for SaveLoadHandler:
DefaultSaveLoadHandler< SlVehicleTrain, Vehicle > DefaultSaveLoadHandler< SlLinkgraphNode, LinkGraph > DefaultSaveLoadHandler< SlCompanyEconomy, CompanyProperties > DefaultSaveLoadHandler< SlStationFlow, GoodsEntry > DefaultSaveLoadHandler< SlGamelogGrfrem, LoggedChange > DefaultSaveLoadHandler< SlGamelogAction, LoggedAction > DefaultSaveLoadHandler< SlVehicleCommon, Vehicle > DefaultSaveLoadHandler< SlStationBase, BaseStation > DefaultSaveLoadHandler< SlCompanySettings, CompanyProperties > DefaultSaveLoadHandler< SlTownSupplied, Town > DefaultSaveLoadHandler< SlLinkgraphJobProxy, LinkGraphJob > DefaultSaveLoadHandler< SlGamelogEmergency, LoggedChange > DefaultSaveLoadHandler< SlCompanyOldAIBuildRec, CompanyOldAI > DefaultSaveLoadHandler< SlVehicleRoadVeh, Vehicle > DefaultSaveLoadHandler< SlGamelogRevision, LoggedChange > DefaultSaveLoadHandler< SlStationCargo, GoodsEntry > DefaultSaveLoadHandler< SlLinkgraphEdge, Node > DefaultSaveLoadHandler< SlGamelogSetting, LoggedChange > DefaultSaveLoadHandler< SlGamelogGrfadd, LoggedChange > DefaultSaveLoadHandler< SlStationNormal, BaseStation > DefaultSaveLoadHandler< SlVehicleEffect, Vehicle > DefaultSaveLoadHandler< SlStationWaypoint, BaseStation > DefaultSaveLoadHandler< SlVehicleDisaster, Vehicle > DefaultSaveLoadHandler< SlStationGoods, BaseStation > DefaultSaveLoadHandler< SlGamelogGrfmove, LoggedChange > DefaultSaveLoadHandler< SlGameLanguageString, LanguageStrings > DefaultSaveLoadHandler< SlCompanyOldAI, CompanyProperties > DefaultSaveLoadHandler< SlGamelogMode, LoggedChange > DefaultSaveLoadHandler< SlGamelogGrfbug, LoggedChange > DefaultSaveLoadHandler< SlVehicleAircraft, Vehicle > DefaultSaveLoadHandler< SlTownReceived, Town > DefaultSaveLoadHandler< SlIndustryProducedHistory, Industry::ProducedCargo > DefaultSaveLoadHandler< SlGamelogGrfcompat, LoggedChange > DefaultSaveLoadHandler< SlTownAcceptanceMatrix, Town > DefaultSaveLoadHandler< SlGamelogGrfparam, LoggedChange > DefaultSaveLoadHandler< SlGamelogOldver, LoggedChange > DefaultSaveLoadHandler< SlVehicleShip, Vehicle > DefaultSaveLoadHandler< SlCompanyLiveries, CompanyProperties > DefaultSaveLoadHandler< TImpl, TObject > SlSkipHandler

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 519 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
objectThe object to fix.

Definition at line 547 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 3293 of file saveload.cpp.

◆ Load()

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

Load the object from disk.

Parameters
objectThe object to load.

Definition at line 535 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
objectThe object to load.

Definition at line 541 of file saveload.h.

◆ Save()

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

Save the object to disk.

Parameters
objectThe object to store.

Definition at line 529 of file saveload.h.


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