|
|
|
@ -13,12 +13,17 @@
|
|
|
|
|
#define NEWGRF_STORAGE_H
|
|
|
|
|
|
|
|
|
|
#include "core/pool_type.hpp"
|
|
|
|
|
#include "tile_type.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Base class for all persistent NewGRF storage arrays. Nothing fancy, only here
|
|
|
|
|
* so we have a generalised access to the virtual methods.
|
|
|
|
|
*/
|
|
|
|
|
struct BasePersistentStorageArray {
|
|
|
|
|
uint32 grfid; ///< GRFID associated to this persistent storage. A value of zero means "default".
|
|
|
|
|
byte feature; ///< NOSAVE: Used to identify in the owner of the array in debug output.
|
|
|
|
|
TileIndex tile; ///< NOSAVE: Used to identify in the owner of the array in debug output.
|
|
|
|
|
|
|
|
|
|
virtual ~BasePersistentStorageArray();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -198,14 +203,14 @@ extern PersistentStoragePool _persistent_storage_pool;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class for pooled persistent storage of data.
|
|
|
|
|
* On #ClearChanges that data is always zero-ed.
|
|
|
|
|
*/
|
|
|
|
|
struct PersistentStorage : PersistentStorageArray<int32, 16>, PersistentStoragePool::PoolItem<&_persistent_storage_pool> {
|
|
|
|
|
uint32 grfid; ///< GRFID associated to this persistent storage. A value of zero means "default".
|
|
|
|
|
|
|
|
|
|
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
|
|
|
|
|
PersistentStorage(const uint32 new_grfid) : grfid(new_grfid)
|
|
|
|
|
PersistentStorage(const uint32 new_grfid, byte feature, TileIndex tile)
|
|
|
|
|
{
|
|
|
|
|
this->grfid = new_grfid;
|
|
|
|
|
this->feature = feature;
|
|
|
|
|
this->tile = tile;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|