OpenTTD
Public Member Functions | Data Fields
TemporaryStorageArray< TYPE, SIZE > Struct Template Reference

Class for temporary storage of data. More...

#include <newgrf_storage.h>

Public Member Functions

 TemporaryStorageArray ()
 Simply construct the array.
void StoreValue (uint pos, int32 value)
 Stores some value at a given position.
TYPE GetValue (uint pos) const
 Gets the value from a given position.
void ClearChanges ()

Data Fields

TYPE storage [SIZE]
 Memory to for the storage array.
uint16 init [SIZE]
 Storage has been assigned, if this equals 'init_key'.
uint16 init_key
 Magic key to 'init'.

Detailed Description

template<typename TYPE, uint SIZE>
struct TemporaryStorageArray< TYPE, SIZE >

Class for temporary storage of data.

On #ClearChanges that data is always zero-ed.

Template Parameters
TYPEthe type of variable to store.
SIZEthe size of the array.

Definition at line 152 of file newgrf_storage.h.

Member Function Documentation

template<typename TYPE, uint SIZE>
TYPE TemporaryStorageArray< TYPE, SIZE >::GetValue ( uint  pos) const
inline

Gets the value from a given position.

Parameters
posthe position to get the data from
Returns
the data from that position

Definition at line 184 of file newgrf_storage.h.

References TemporaryStorageArray< TYPE, SIZE >::init, TemporaryStorageArray< TYPE, SIZE >::init_key, and TemporaryStorageArray< TYPE, SIZE >::storage.

Referenced by GetRegister(), StartTextRefStackUsage(), and CommandCost::UseTextRefStack().

template<typename TYPE, uint SIZE>
void TemporaryStorageArray< TYPE, SIZE >::StoreValue ( uint  pos,
int32  value 
)
inline

Stores some value at a given position.

Parameters
posthe position to write at
valuethe value to write

Definition at line 170 of file newgrf_storage.h.

References TemporaryStorageArray< TYPE, SIZE >::init, TemporaryStorageArray< TYPE, SIZE >::init_key, and TemporaryStorageArray< TYPE, SIZE >::storage.


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