OpenTTD Source: VehicleScopeResolver Struct Reference

OpenTTD Source 13.1

Public Member Functions | Data Fields
VehicleScopeResolver Struct Reference

Resolver for a vehicle scope. More...

`#include <newgrf_engine.h>`

Inheritance diagram for VehicleScopeResolver:

## Public Member Functions
| VehicleScopeResolver (ResolverObject &ro, EngineID engine_type, const Vehicle *v, bool rotor_in_gui)
| Scope resolver of a single vehicle. More...
void | SetVehicle (const Vehicle *v)
uint32 | GetRandomBits () const override
| Get a few random bits. More...
uint32 | GetVariable (byte variable, uint32 parameter, bool *available) const override
| Get a variable value. More...
uint32 | GetTriggers () const override
| Get the triggers. More...
Public Member Functions inherited from ScopeResolver
| ScopeResolver (ResolverObject &ro)
virtual void | StorePSA (uint reg, int32 value)
| Store a value into the persistent storage area (PSA). More...

## Data Fields
const struct Vehicle * | v
| The vehicle being resolved.
EngineID | self_type
| Type of the vehicle.
bool | rotor_in_gui
| Helicopter rotor is drawn in GUI.
Data Fields inherited from ScopeResolver
ResolverObject & | ro
| Surrounding resolver object.

## Detailed Description

Resolver for a vehicle scope.

Definition at line 22 of file newgrf_engine.h.

## Constructor & Destructor Documentation

## ◆ VehicleScopeResolver()

VehicleScopeResolver::VehicleScopeResolver | ( | ResolverObject & | ro,
|  | EngineID | engine_type,
|  | const Vehicle * | v,
|  | bool | rotor_in_gui
| ) |  |
| inline

Scope resolver of a single vehicle.

Parameters

  ro | Surrounding resolver.
  engine_type | Engine type
  v | Vehicle being resolved.
  rotor_in_gui | Helicopter rotor is drawn in GUI.

Definition at line 34 of file newgrf_engine.h.

## Member Function Documentation

## ◆ GetRandomBits()

uint32 VehicleScopeResolver::GetRandomBits | ( |  | ) | const
| overridevirtual

Get a few random bits.

Default implementation has no random bits.

Returns
  Random bits.

Reimplemented from ScopeResolver.

Definition at line 306 of file newgrf_engine.cpp.

References Vehicle::random_bits.

## ◆ GetTriggers()

uint32 VehicleScopeResolver::GetTriggers | ( |  | ) | const
| overridevirtual

Get the triggers.

Base class returns `0` to prevent trouble.

Returns
  The triggers.

Reimplemented from ScopeResolver.

Definition at line 311 of file newgrf_engine.cpp.

References Vehicle::waiting_triggers.

## ◆ GetVariable()

uint32 VehicleScopeResolver::GetVariable | ( | byte | variable,
|  | uint32 | 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 955 of file newgrf_engine.cpp.

References _cur_year, _current_company, _date, GRFFile::cargo_map, Clamp(), CargoSpec::classes, CT_INVALID, DAYS_TILL_ORIGINAL_BASE_YEAR, GB(), CargoSpec::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GetCompanyInfo(), Engine::GetDefaultCargoType(), ResolverObject::grffile, INVALID_VEHICLE, LiveryHelper(), ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR, ScopeResolver::ro, self_type, and CargoSpec::weight.

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

- src/newgrf_engine.h
- src/newgrf_engine.cpp