OpenTTD Source: GenericScopeResolver Struct Reference

OpenTTD Source 15.0-RC2

Public Member Functions | Data Fields | Private Attributes
GenericScopeResolver Struct Reference

Scope resolver for generic objects and properties. More...

Inheritance diagram for GenericScopeResolver:

## Public Member Functions
| GenericScopeResolver (ResolverObject &ro, bool ai_callback)
| Generic scope resolver.
uint32_t | GetVariable (uint8_t variable, uint32_t parameter, bool &available) const override
| Get a variable value.
Public Member Functions inherited from ScopeResolver
| ScopeResolver (ResolverObject &ro)
virtual uint32_t | GetRandomBits () const
| Get a few random bits.
virtual uint32_t | GetRandomTriggers () const
| Get the triggers.
virtual void | StorePSA (uint reg, int32_t value)
| Store a value into the persistent storage area (PSA).

## Data Fields
CargoType | cargo_type
uint8_t | default_selection
uint8_t | src_industry
| Source industry substitute type. 0xFF for "town", 0xFE for "unknown".
uint8_t | dst_industry
| Destination industry substitute type. 0xFF for "town", 0xFE for "unknown".
uint8_t | distance
AIConstructionEvent | event
uint8_t | count
uint8_t | station_size
GrfSpecFeature | feature
Data Fields inherited from ScopeResolver
ResolverObject & | ro
| Surrounding resolver object.

## Private Attributes
bool | ai_callback
| Callback comes from the AI.

## Detailed Description

Scope resolver for generic objects and properties.

Definition at line 21 of file newgrf_generic.cpp.

## Constructor & Destructor Documentation

## ◆ GenericScopeResolver()

GenericScopeResolver::GenericScopeResolver | ( | ResolverObject & | ro,
|  | bool | ai_callback
| ) |  |
| inline

Generic scope resolver.

Parameters

  ro | Surrounding resolver.
  ai_callback | Callback comes from the AI.

Definition at line 38 of file newgrf_generic.cpp.

## Member Function Documentation

## ◆ GetVariable()

uint32_t GenericScopeResolver::GetVariable | ( | uint8_t | variable,
|  | 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 121 of file newgrf_generic.cpp.

References ai_callback, CargoSpec::bitnum, GRFFile::cargo_map, Debug, dst_industry, CargoSpec::Get(), ResolverObject::grffile, ScopeResolver::ro, and src_industry.

## Field Documentation

## ◆ ai_callback

bool GenericScopeResolver::ai_callback
| private

Callback comes from the AI.

Definition at line 47 of file newgrf_generic.cpp.

Referenced by GetVariable().

## ◆ cargo_type

CargoType GenericScopeResolver::cargo_type

Definition at line 22 of file newgrf_generic.cpp.

## ◆ count

uint8_t GenericScopeResolver::count

Definition at line 28 of file newgrf_generic.cpp.

## ◆ default_selection

uint8_t GenericScopeResolver::default_selection

Definition at line 23 of file newgrf_generic.cpp.

## ◆ distance

uint8_t GenericScopeResolver::distance

Definition at line 26 of file newgrf_generic.cpp.

## ◆ dst_industry

uint8_t GenericScopeResolver::dst_industry

Destination industry substitute type. 0xFF for "town", 0xFE for "unknown".

Definition at line 25 of file newgrf_generic.cpp.

Referenced by GetVariable().

## ◆ event

AIConstructionEvent GenericScopeResolver::event

Definition at line 27 of file newgrf_generic.cpp.

## ◆ feature

GrfSpecFeature GenericScopeResolver::feature

Definition at line 31 of file newgrf_generic.cpp.

## ◆ src_industry

uint8_t GenericScopeResolver::src_industry

Source industry substitute type. 0xFF for "town", 0xFE for "unknown".

Definition at line 24 of file newgrf_generic.cpp.

Referenced by GetVariable().

## ◆ station_size

uint8_t GenericScopeResolver::station_size

Definition at line 29 of file newgrf_generic.cpp.

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

- src/newgrf_generic.cpp