OpenTTD
Public Member Functions | Data Fields
IndustriesScopeResolver Struct Reference

Resolver for industry scopes. More...

#include <newgrf_industries.h>

Inheritance diagram for IndustriesScopeResolver:
ScopeResolver

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).
- Public Member Functions inherited from ScopeResolver
 ScopeResolver (ResolverObject &ro)

Data Fields

TileIndex tile
 Tile owned by the industry.
Industryindustry
 Industry being resolved.
IndustryType type
 Type of the industry.
uint32 random_bits
 Random bits of the new industry.
- Data Fields inherited from ScopeResolver
ResolverObjectro
 Surrounding resolver object.

Detailed Description

Resolver for industry scopes.

Definition at line 18 of file newgrf_industries.h.

Constructor & Destructor Documentation

IndustriesScopeResolver::IndustriesScopeResolver ( ResolverObject ro,
TileIndex  tile,
Industry industry,
IndustryType  type,
uint32  random_bits = 0 
)

Scope resolver for industries.

Parameters
roSurrounding resolver.
tileTile owned by the industry.
industryIndustry being resolved.
typeType of the industry.
random_bitsRandom bits of the new industry.

Definition at line 474 of file newgrf_industries.cpp.

References industry, random_bits, tile, and type.

Member Function Documentation

uint32 IndustriesScopeResolver::GetRandomBits ( ) const
virtual

Get a few random bits.

Default implementation has no random bits.

Returns
Random bits.

Reimplemented from ScopeResolver.

Definition at line 376 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.

Returns
The triggers.

Reimplemented from ScopeResolver.

Definition at line 381 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.

Parameters
variableVariable to read
parameterParameter for 60+x variables
[out]availableSet to false, in case the variable does not exist.
Returns
Value

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.

void IndustriesScopeResolver::SetTriggers ( int  triggers) const
virtual

Set the triggers.

Base class implementation does nothing.

Parameters
triggersTriggers 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.

void IndustriesScopeResolver::StorePSA ( uint  reg,
int32  value 
)
virtual

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