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). | |
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. |
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 457 of file newgrf_industries.cpp.
uint32 IndustriesScopeResolver::GetRandomBits | ( | ) | const [virtual] |
Get a few random bits.
Default implementation has no random bits.
Reimplemented from ScopeResolver.
Definition at line 362 of file newgrf_industries.cpp.
References industry, and Industry::random.
uint32 IndustriesScopeResolver::GetTriggers | ( | ) | const [virtual] |
Get the triggers.
Base class returns 0
to prevent trouble.
Reimplemented from ScopeResolver.
Definition at line 367 of file newgrf_industries.cpp.
References industry, and Industry::random_triggers.
uint32 IndustriesScopeResolver::GetVariable | ( | byte | variable, | |
uint32 | parameter, | |||
bool * | available | |||
) | const [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 160 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, TileArea::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, 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, 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, TileArea::tile, TILE_HEIGHT, Industry::TileBelongsToIndustry(), Industry::town, Industry::type, TileArea::w, Industry::was_cargo_delivered, and Town::xy.
void IndustriesScopeResolver::SetTriggers | ( | int | triggers | ) | const [virtual] |
Set the triggers.
Base class implementation does nothing.
triggers | Triggers to set. |
Reimplemented from ScopeResolver.
Definition at line 372 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.
void IndustriesScopeResolver::StorePSA | ( | uint | reg, | |
int32 | value | |||
) | [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 378 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::psa, PersistentStorageArray< TYPE, SIZE >::StoreValue(), and Industry::type.