OpenTTD Source 20241224-master-gf74b0cf984
|
Scope resolver for a town. More...
#include <newgrf_town.h>
Public Member Functions | |
TownScopeResolver (ResolverObject &ro, Town *t, bool readonly) | |
Resolver of a town scope. | |
uint32_t | GetVariable (uint8_t variable, uint32_t parameter, bool &available) const override |
Get a variable value. | |
void | StorePSA (uint reg, int32_t value) override |
Store a value into the persistent storage area (PSA). | |
Public Member Functions inherited from ScopeResolver | |
ScopeResolver (ResolverObject &ro) | |
virtual uint32_t | GetRandomBits () const |
Get a few random bits. | |
virtual uint32_t | GetTriggers () const |
Get the triggers. | |
Data Fields | |
Town * | t |
Town of the scope. | |
bool | readonly |
When set, persistent storage of the town is read-only,. | |
Data Fields inherited from ScopeResolver | |
ResolverObject & | ro |
Surrounding resolver object. | |
Scope resolver for a town.
Definition at line 22 of file newgrf_town.h.
|
inline |
Resolver of a town scope.
ro | Surrounding resolver. |
t | Town of the scope. |
readonly | Scope may change persistent storage of the town. |
Definition at line 32 of file newgrf_town.h.
|
overridevirtual |
Get a variable value.
Default implementation has no available variables.
variable | Variable to read | |
parameter | Parameter for 60+x variables | |
[out] | available | Set to false, in case the variable does not exist. |
Reimplemented from ScopeResolver.
Definition at line 18 of file newgrf_town.cpp.
References _settings_game, Town::cache, CT_PASSENGERS, Debug, GameSettings::economy, Town::flags, Town::fund_buildings_months, GB(), GetRegister(), ResolverObject::grffile, Town::grow_counter, Town::growth_rate, Town::have_ratings, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsValidCargoID(), Town::larger_town, EconomySettings::larger_towns, TransportedCargoStat< Tstorage >::new_act, TransportedCargoStat< Tstorage >::new_max, TownCache::num_houses, TransportedCargoStat< Tstorage >::old_act, TransportedCargoStat< Tstorage >::old_max, TownCache::population, Town::ratings, Town::received, ScopeResolver::ro, Town::road_build_months, TownCache::squared_town_zone_radius, Town::statues, Town::supplied, t, TAE_FOOD, TAE_WATER, Ticks::TOWN_GROWTH_TICKS, and Town::xy.
|
overridevirtual |
Store a value into the persistent storage area (PSA).
Default implementation does nothing (for newgrf classes without storage).
Reimplemented from ScopeResolver.
Definition at line 126 of file newgrf_town.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_persistent_storage_pool >::CanAllocateItem(), GetRegister(), ResolverObject::grffile, GSF_FAKE_TOWNS, readonly, ScopeResolver::ro, PersistentStorageArray< TYPE, SIZE >::StoreValue(), t, and Town::xy.
bool TownScopeResolver::readonly |
When set, persistent storage of the town is read-only,.
Definition at line 24 of file newgrf_town.h.
Referenced by StorePSA().
Town* TownScopeResolver::t |
Town of the scope.
Definition at line 23 of file newgrf_town.h.
Referenced by GetVariable(), and StorePSA().