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 AirportScopeResolver, AirportTileScopeResolver, CanalScopeResolver, VehicleScopeResolver, HouseScopeResolver, IndustriesScopeResolver, IndustryTileScopeResolver, ObjectScopeResolver, RailTypeScopeResolver, and StationScopeResolver.

Definition at line 96 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 VehicleScopeResolver, HouseScopeResolver, IndustriesScopeResolver, IndustryTileScopeResolver, and StationScopeResolver.

Definition at line 105 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 AirportScopeResolver, AirportTileScopeResolver, CanalScopeResolver, VehicleScopeResolver, GenericScopeResolver, HouseScopeResolver, IndustriesScopeResolver, IndustryTileScopeResolver, ObjectScopeResolver, RailTypeScopeResolver, StationScopeResolver, and TownScopeResolver.

Definition at line 123 of file newgrf_spritegroup.cpp.

References DEBUG.

Referenced by FillNewGRFVehicleCache(), NIHTown::Resolve(), NIHAirportTile::Resolve(), NIHRailType::Resolve(), NIHObject::Resolve(), NIHIndustry::Resolve(), NIHIndustryTile::Resolve(), NIHHouse::Resolve(), NIHStation::Resolve(), and NIHVehicle::Resolve().

void ScopeResolver::SetTriggers | ( | int | triggers | ) | const`[virtual]`

Set the triggers.

Base class implementation does nothing.

Parameters:

  | triggers | Triggers to set.

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

Definition at line 114 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, IndustriesScopeResolver, and TownScopeResolver.

Definition at line 135 of file newgrf_spritegroup.cpp.

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

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