OpenTTD
|
Resolver for industry scopes. More...
#include <newgrf_industries.h>
Public Member Functions | |
IndustriesScopeResolver (ResolverObject &ro, TileIndex tile, Industry *industry, IndustryType type, uint32 random_bits=0) | |
Scope resolver for industries. | |
uint32 | GetRandomBits () const |
Get a few random bits. | |
uint32 | GetVariable (byte variable, uint32 parameter, bool *available) const |
Get a variable value. | |
uint32 | GetTriggers () const |
Get the triggers. | |
void | SetTriggers (int triggers) const |
Set the triggers. | |
void | StorePSA (uint pos, int32 value) |
Store a value into the persistent storage area (PSA). | |
![]() | |
ScopeResolver (ResolverObject &ro) |
Data Fields | |
TileIndex | tile |
Tile owned by the industry. | |
Industry * | industry |
Industry being resolved. | |
IndustryType | type |
Type of the industry. | |
uint32 | random_bits |
Random bits of the new industry. | |
![]() | |
ResolverObject & | ro |
Surrounding resolver object. |
Resolver for industry scopes.
Definition at line 18 of file newgrf_industries.h.
IndustriesScopeResolver::IndustriesScopeResolver | ( | ResolverObject & | ro, |
TileIndex | tile, | ||
Industry * | industry, | ||
IndustryType | type, | ||
uint32 | random_bits = 0 |
||
) |
Scope resolver for industries.
ro | Surrounding resolver. |
tile | Tile owned by the industry. |
industry | Industry being resolved. |
type | Type of the industry. |
random_bits | Random bits of the new industry. |
Definition at line 474 of file newgrf_industries.cpp.
References industry, random_bits, tile, and type.
|
virtual |
Get a few random bits.
Default implementation has no random bits.
Reimplemented from ScopeResolver.
Definition at line 376 of file newgrf_industries.cpp.
References industry, and Industry::random.
|
virtual |
Get the triggers.
Base class returns 0
to prevent trouble.
Reimplemented from ScopeResolver.
Definition at line 381 of file newgrf_industries.cpp.
References industry, and Industry::random_triggers.
|
virtual |
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 162 of file newgrf_industries.cpp.
References Industry::accepts_cargo, IndustrySpec::behaviour, ResolverObject::callback, IndustrySpec::callback_mask, CBID_INDUSTRY_LOCATION, CBM_IND_PRODUCTION_256_TICKS, CBM_IND_PRODUCTION_CARGO_ARRIVAL, Clamp(), Livery::colour1, Livery::colour2, Industry::construction_date, Industry::construction_type, Industry::counter, DAYS_TILL_ORIGINAL_BASE_YEAR, DEBUG, DistanceManhattan(), DistanceSquare(), Industry::founder, GB(), GetAnimationFrame(), GetClosestWaterDistance(), GetCountAndDistanceOfClosestInstance(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), GetIndustryIDAtOffset(), GetIndustryRandomBits(), GetIndustrySpec(), GetNearbyIndustryTileInformation(), GetNearbyTile(), GetRegister(), GetTerrainType(), GetTileZ(), GetTownRadiusGroup(), PersistentStorageArray< TYPE, SIZE >::GetValue(), IndustrySpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, ResolverObject::grffile, OrthogonalTileArea::h, HasBit(), Industry::incoming_cargo_waiting, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, industry, INDUSTRYBEH_BUILT_ONWATER, INDUSTRYBEH_PROD_MULTI_HNDLING, INVALID_TILE, CompanyProperties::is_ai, Industry::last_cargo_accepted_at, Industry::last_month_pct_transported, Industry::last_month_production, Industry::last_month_transported, Industry::last_prod_year, GRFFilePropsBase< Tcnt >::local_id, Industry::location, MapNewGRFIndustryType(), min(), ORIGINAL_BASE_YEAR, Industry::prod_level, Industry::produced_cargo, Industry::produced_cargo_waiting, Industry::production_rate, Industry::psa, random_bits, Industry::random_colour, ScopeResolver::ro, Industry::selected_layout, Industry::this_month_production, Industry::this_month_transported, tile, OrthogonalTileArea::tile, TILE_HEIGHT, Industry::TileBelongsToIndustry(), Industry::town, Industry::type, OrthogonalTileArea::w, Industry::was_cargo_delivered, and Town::xy.
|
virtual |
Set the triggers.
Base class implementation does nothing.
triggers | Triggers to set. |
Reimplemented from ScopeResolver.
Definition at line 386 of file newgrf_industries.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, industry, and Industry::random_triggers.
|
virtual |
Store a value into the persistent storage area (PSA).
Default implementation does nothing (for newgrf classes without storage).
pos | Position to store into. |
value | Value to store. |
Reimplemented from ScopeResolver.
Definition at line 392 of file newgrf_industries.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_persistent_storage_pool >::CanAllocateItem(), GetIndustrySpec(), IndustrySpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, industry, Industry::location, Industry::psa, PersistentStorageArray< TYPE, SIZE >::StoreValue(), OrthogonalTileArea::tile, and Industry::type.