OpenTTD: ScopeResolver Struct Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields
ScopeResolver Struct Reference

Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope). More...

`#include <newgrf_spritegroup.h>`

Inheritance diagram for ScopeResolver:

## Public Member Functions
| ScopeResolver (ResolverObject &ro)
virtual uint32 | GetRandomBits () const
| Get a few random bits.
virtual uint32 | GetTriggers () const
| Get the triggers.
virtual void | SetTriggers (int triggers) const
| Set the triggers.
virtual uint32 | GetVariable (byte variable, uint32 parameter, bool *available) const
| Get a variable value.
virtual void | StorePSA (uint reg, int32 value)
| Store a value into the persistent storage area (PSA).

## Data Fields
ResolverObject & | ro
| Surrounding resolver object.

## Detailed Description

Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope).

Multiple of these interfaces are combined into a ResolverObject to allow access to different game entities from a SpriteGroup-chain (action 1-2-3 chain).

Definition at line 288 of file newgrf_spritegroup.h.

## Member Function Documentation

uint32 ScopeResolver::GetRandomBits | ( |  | ) | const
| virtual

Get a few random bits.

Default implementation has no random bits.

Returns
  Random bits.

Reimplemented in ObjectScopeResolver, StationScopeResolver, VehicleScopeResolver, HouseScopeResolver, AirportScopeResolver, CanalScopeResolver, AirportTileScopeResolver, IndustriesScopeResolver, IndustryTileScopeResolver, and RailTypeScopeResolver.

Definition at line 98 of file newgrf_spritegroup.cpp.

Referenced by RandomizedSpriteGroup::Resolve().

uint32 ScopeResolver::GetTriggers | ( |  | ) | const
| virtual

Get the triggers.

Base class returns `0` to prevent trouble.

Returns
  The triggers.

Reimplemented in StationScopeResolver, VehicleScopeResolver, HouseScopeResolver, IndustriesScopeResolver, and IndustryTileScopeResolver.

Definition at line 107 of file newgrf_spritegroup.cpp.

Referenced by RandomizedSpriteGroup::Resolve().

uint32 ScopeResolver::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 in ObjectScopeResolver, StationScopeResolver, GenericScopeResolver, VehicleScopeResolver, HouseScopeResolver, AirportScopeResolver, CanalScopeResolver, AirportTileScopeResolver, TownScopeResolver, IndustriesScopeResolver, IndustryTileScopeResolver, and RailTypeScopeResolver.

Definition at line 125 of file newgrf_spritegroup.cpp.

References DEBUG.

Referenced by FillNewGRFVehicleCache().

void ScopeResolver::SetTriggers | ( | int | triggers | ) | const
| virtual

Set the triggers.

Base class implementation does nothing.

Parameters

  triggers | Triggers to set.

Reimplemented in StationScopeResolver, VehicleScopeResolver, HouseScopeResolver, IndustriesScopeResolver, and IndustryTileScopeResolver.

Definition at line 116 of file newgrf_spritegroup.cpp.

Referenced by RandomizedSpriteGroup::Resolve().

void ScopeResolver::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 in AirportScopeResolver, TownScopeResolver, and IndustriesScopeResolver.

Definition at line 137 of file newgrf_spritegroup.cpp.

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

- src/newgrf_spritegroup.h
- src/newgrf_spritegroup.cpp