OpenTTD Source: IndustriesScopeResolver Struct Reference

OpenTTD Source 14.1

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_t random_bits=0)
| Scope resolver for industries. More...
uint32_t | GetRandomBits () const override
| Get a few random bits. More...
uint32_t | GetVariable (byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override
| Get a variable value. More...
uint32_t | GetTriggers () const override
| Get the triggers. More...
void | StorePSA (uint pos, int32_t value) override
| Store a value into the persistent storage area (PSA). More...
Public Member Functions inherited from ScopeResolver
| ScopeResolver (ResolverObject &ro)

## Data Fields
TileIndex | tile
| Tile owned by the industry.
Industry * | industry
| Industry being resolved.
IndustryType | type
| Type of the industry.
uint32_t | random_bits
| Random bits of the new industry.
Data Fields inherited from ScopeResolver
ResolverObject & | ro
| 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

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

## ◆ GetVariable()

uint32_t IndustriesScopeResolver::GetVariable | ( | byte | variable,
|  | [[maybe_unused] ] uint32_t | parameter,
|  | bool * | available
| ) |  | const
| overridevirtual

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

References IndustrySpec::behaviour, ResolverObject::callback, CBID_INDUSTRY_LOCATION, Debug, DistanceManhattan(), DistanceSquare(), GB(), GetClosestWaterDistance(), GetIndustrySpec(), GetTerrainType(), GetTileZ(), GetTownRadiusGroup(), ResolverObject::grffile, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, industry, INDUSTRYBEH_BUILT_ONWATER, random_bits, ScopeResolver::ro, Industry::selected_layout, TILE_HEIGHT, Industry::town, Industry::type, and Town::xy.

## ◆ StorePSA()

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

Store a value into the persistent storage area (PSA).

Default implementation does nothing (for newgrf classes without storage).

Reimplemented from ScopeResolver.

Definition at line 428 of file newgrf_industries.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and industry.

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

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