OpenTTD Source 20241224-master-gf74b0cf984
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_t random_bits=0)
 Scope resolver for industries.
 
uint32_t GetRandomBits () const override
 Get a few random bits.
 
uint32_t GetVariable (uint8_t variable, uint32_t parameter, bool &available) const override
 Get a variable value.
 
uint32_t GetTriggers () const override
 Get the triggers.
 
void StorePSA (uint pos, int32_t value) override
 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_t 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 16 of file newgrf_industries.h.

Constructor & Destructor Documentation

◆ IndustriesScopeResolver()

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

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 30 of file newgrf_industries.h.

Member Function Documentation

◆ GetRandomBits()

uint32_t IndustriesScopeResolver::GetRandomBits ( ) const
overridevirtual

Get a few random bits.

Default implementation has no random bits.

Returns
Random bits.

Reimplemented from ScopeResolver.

Definition at line 426 of file newgrf_industries.cpp.

References industry, and Industry::random.

◆ GetTriggers()

uint32_t IndustriesScopeResolver::GetTriggers ( ) const
overridevirtual

Get the triggers.

Base class returns 0 to prevent trouble.

Returns
The triggers.

Reimplemented from ScopeResolver.

Definition at line 431 of file newgrf_industries.cpp.

◆ GetVariable()

uint32_t IndustriesScopeResolver::GetVariable ( uint8_t  variable,
uint32_t  parameter,
bool &  available 
) const
overridevirtual

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 163 of file newgrf_industries.cpp.

References Industry::accepted, IndustrySpec::behaviour, ResolverObject::callback, IndustrySpec::callback_mask, Industry::ProducedCargo::cargo, Industry::AcceptedCargo::cargo, CBID_INDUSTRY_LOCATION, CBM_IND_PRODUCTION_256_TICKS, CBM_IND_PRODUCTION_CARGO_ARRIVAL, Livery::colour1, Livery::colour2, Industry::construction_date, Industry::construction_type, Industry::counter, Industry::ctlflags, TimerGameConst< struct Calendar >::DAYS_TILL_ORIGINAL_BASE_YEAR, TimerGameConst< struct Economy >::DAYS_TILL_ORIGINAL_BASE_YEAR, Debug, DistanceManhattan(), DistanceSquare(), Industry::founder, GB(), Industry::GetAccepted(), GetAnimationFrame(), Industry::GetCargoAccepted(), Industry::GetCargoProduced(), GetCargoTranslation(), GetClosestWaterDistance(), GetCountAndDistanceOfClosestInstance(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), GetIndustryIDAtOffset(), GetIndustryRandomBits(), GetIndustrySpec(), GetNearbyIndustryTileInformation(), GetNearbyTile(), Industry::GetProduced(), GetRegister(), GetTerrainType(), GetTileZ(), GetTownRadiusGroup(), PersistentStorageArray< TYPE, SIZE >::GetValue(), IndustrySpec::grf_prop, ResolverObject::grffile, GRFFilePropsBase< Tcnt >::grfid, OrthogonalTileArea::h, HasBit(), Industry::ProducedCargo::history, 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, IsValidCargoID(), Industry::last_prod_year, GRFFilePropsBase< Tcnt >::local_id, Industry::location, MapNewGRFIndustryType(), NUM_INDUSTRYTYPES, TimerGameConst< struct Economy >::ORIGINAL_BASE_YEAR, Industry::prod_level, Industry::produced, Industry::psa, random_bits, Industry::random_colour, Industry::ProducedCargo::rate, ScopeResolver::ro, Industry::selected_layout, tile, OrthogonalTileArea::tile, TILE_HEIGHT, Industry::TileBelongsToIndustry(), Industry::town, Industry::type, type, OrthogonalTileArea::w, Industry::ProducedCargo::waiting, Industry::AcceptedCargo::waiting, Industry::was_cargo_delivered, and Town::xy.

◆ StorePSA()

void IndustriesScopeResolver::StorePSA ( uint  reg,
int32_t  value 
)
overridevirtual

Field Documentation

◆ industry

Industry* IndustriesScopeResolver::industry

Industry being resolved.

Definition at line 18 of file newgrf_industries.h.

Referenced by GetRandomBits(), IndustriesResolverObject::GetTown(), GetVariable(), and StorePSA().

◆ random_bits

uint32_t IndustriesScopeResolver::random_bits

Random bits of the new industry.

Definition at line 20 of file newgrf_industries.h.

Referenced by GetVariable().

◆ tile

TileIndex IndustriesScopeResolver::tile

Tile owned by the industry.

Definition at line 17 of file newgrf_industries.h.

Referenced by IndustriesResolverObject::GetTown(), and GetVariable().

◆ type

IndustryType IndustriesScopeResolver::type

Type of the industry.

Definition at line 19 of file newgrf_industries.h.

Referenced by IndustriesResolverObject::GetDebugID(), and GetVariable().


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