OpenTTD Source 20260711-master-g3fb3006dff
PersistentStorage Struct Reference

Class for pooled persistent storage of data. More...

#include <newgrf_storage.h>

Inheritance diagram for PersistentStorage:
PersistentStorageArray< int32_t, 256 > BasePersistentStorageArray

Public Member Functions

 PersistentStorage (PersistentStorageID index, GrfID grfid, GrfSpecFeature feature, TileIndex tile)
 Create the pooled storage.
Public Member Functions inherited from PersistentStorageArray< int32_t, 256 >
void StoreValue (uint pos, int32_t value)
 Stores some value at a given position.
int32_t GetValue (uint pos) const
 Gets the value from a given position.
void ClearChanges () override
 Discard temporary changes.
Public Member Functions inherited from BasePersistentStorageArray
virtual ~BasePersistentStorageArray ()
 Remove references to us.

Additional Inherited Members

Public Types inherited from PersistentStorageArray< int32_t, 256 >
using StorageType
Static Public Member Functions inherited from BasePersistentStorageArray
static void SwitchMode (PersistentStorageMode mode, bool ignore_prev_mode=false)
 Clear temporary changes made since the last call to SwitchMode, and set whether subsequent changes shall be persistent or temporary.
Data Fields inherited from PersistentStorageArray< int32_t, 256 >
StorageType storage
 Memory for the storage array.
std::unique_ptr< StorageType > prev_storage
 Temporary memory to store previous state so it can be reverted, e.g. for command tests.
Data Fields inherited from BasePersistentStorageArray
GrfID grfid {}
 GRFID associated to this persistent storage. A value of zero means "default".
GrfSpecFeature feature = GrfSpecFeature::Invalid
 NOSAVE: Used to identify in the owner of the array in debug output.
TileIndex tile = INVALID_TILE
 NOSAVE: Used to identify in the owner of the array in debug output.
Static Protected Member Functions inherited from BasePersistentStorageArray
static bool AreChangesPersistent ()
 Check whether currently changes to the storage shall be persistent or temporary till the next call to ClearChanges().

Detailed Description

Class for pooled persistent storage of data.

Definition at line 200 of file newgrf_storage.h.

Constructor & Destructor Documentation

◆ PersistentStorage()

PersistentStorage::PersistentStorage ( PersistentStorageID index,
GrfID grfid,
GrfSpecFeature feature,
TileIndex tile )
inline

Create the pooled storage.

Parameters
indexThe unique identifier of the pool item.
grfidThe NewGRF this storage is of.
featureThe feature associated with this storage.
tileThe tile associated with this storage.

Definition at line 208 of file newgrf_storage.h.

References BasePersistentStorageArray::feature, BasePersistentStorageArray::grfid, and BasePersistentStorageArray::tile.


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