OpenTTD Source 20260704-master-gbf70c61fb8
SavegameFileType Struct Reference

Container/wrapper for the file type that is used in tables in the save game. More...

Public Member Functions

 SavegameFileType ()
 Create an end-of-table marker.
 SavegameFileType (VarFileType file_type, bool has_field_length=false)
 Create the type.
constexpr bool IsEnd () const
 Is this the end-of-table marker?
constexpr bool HasFieldLength () const
 Does this field have a length?
constexpr VarFileType Type () const
 Get the VarType for this field.

Data Fields

uint8_t storage {}
 Actual storage of the file type.

Static Public Attributes

static constexpr uint8_t HAS_FIELD_LENGTH_BIT = 4
 Set this bit to denote the type has a field length.

Detailed Description

Container/wrapper for the file type that is used in tables in the save game.

This is essentially VarFileType, but with a bit denoting that the type has a field length and a value denoting end-of-table.

Definition at line 575 of file saveload.cpp.

Constructor & Destructor Documentation

◆ SavegameFileType() [1/2]

SavegameFileType::SavegameFileType ( )
inline

Create an end-of-table marker.

Definition at line 580 of file saveload.cpp.

◆ SavegameFileType() [2/2]

SavegameFileType::SavegameFileType ( VarFileType file_type,
bool has_field_length = false )
inline

Create the type.

Parameters
file_typeThe file type.
has_field_lengthDoes this field have a length?

Definition at line 587 of file saveload.cpp.

References AssignBit(), HAS_FIELD_LENGTH_BIT, IsInsideMM(), storage, and to_underlying().

Member Function Documentation

◆ HasFieldLength()

bool SavegameFileType::HasFieldLength ( ) const
inlineconstexpr

Does this field have a length?

Returns
true iff this field has a length.

Definition at line 604 of file saveload.cpp.

References HAS_FIELD_LENGTH_BIT, HasBit(), and IsEnd().

Referenced by SlTableHeader().

◆ IsEnd()

bool SavegameFileType::IsEnd ( ) const
inlineconstexpr

Is this the end-of-table marker?

Returns
true iff this is an end-of-table marker.

Definition at line 598 of file saveload.cpp.

References storage.

Referenced by HasFieldLength(), SlTableHeader(), and Type().

◆ Type()

VarFileType SavegameFileType::Type ( ) const
inlineconstexpr

Get the VarType for this field.

Returns
The VarType.

Definition at line 614 of file saveload.cpp.

References GB(), HAS_FIELD_LENGTH_BIT, IsEnd(), and storage.

Referenced by SlTableHeader().

Field Documentation

◆ HAS_FIELD_LENGTH_BIT

uint8_t SavegameFileType::HAS_FIELD_LENGTH_BIT = 4
staticconstexpr

Set this bit to denote the type has a field length.

Definition at line 576 of file saveload.cpp.

Referenced by HasFieldLength(), SavegameFileType(), and Type().

◆ storage

uint8_t SavegameFileType::storage {}

Actual storage of the file type.

Definition at line 577 of file saveload.cpp.

Referenced by IsEnd(), SavegameFileType(), SlTableHeader(), and Type().


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