Public Member Functions | Data Fields

# IndustriesScopeResolver Struct Reference

Resolver for industry scopes. More...

`#include <newgrf_industries.h>`

Inheritance diagram for IndustriesScopeResolver:

## 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.

## 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:

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

## 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 374 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 379 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:

  | variable | Variable to read
  | parameter | Parameter for 60+x variables
  `[out]` | available | Set to false, in case the variable does not exist.

Returns:
  Value

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, 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, 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, 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:

  | triggers | Triggers to set.

Reimplemented from ScopeResolver.

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

Parameters:

  | pos | Position to store into.
  | value | Value to store.

Reimplemented from ScopeResolver.

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

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

- src/newgrf_industries.h
- src/newgrf_industries.cpp