OpenTTD Source: ScopeResolver Struct Reference

OpenTTD Source 14.0-RC3

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_t | GetRandomBits () const
| Get a few random bits. More...
virtual uint32_t | GetTriggers () const
| Get the triggers. More...
virtual uint32_t | GetVariable (byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const
| Get a variable value. More...
virtual void | StorePSA (uint reg, int32_t value)
| Store a value into the persistent storage area (PSA). More...

## 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

## ◆ GetRandomBits()

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

Get a few random bits.

Default implementation has no random bits.

Returns
  Random bits.

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

Definition at line 85 of file newgrf_spritegroup.cpp.

## ◆ GetTriggers()

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

Get the triggers.

Base class returns `0` to prevent trouble.

Returns
  The triggers.

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

Definition at line 94 of file newgrf_spritegroup.cpp.

## ◆ GetVariable()

uint32_t ScopeResolver::GetVariable | ( | byte | variable,
|  | [[maybe_unused] ] uint32_t | 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, ObjectScopeResolver, RoadStopScopeResolver, HouseScopeResolver, StationScopeResolver, GenericScopeResolver, VehicleScopeResolver, AirportTileScopeResolver, TownScopeResolver, IndustriesScopeResolver, RoadTypeScopeResolver, RailTypeScopeResolver, IndustryTileScopeResolver, and CanalScopeResolver.

Definition at line 106 of file newgrf_spritegroup.cpp.

References Debug.

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

## ◆ StorePSA()

void ScopeResolver::StorePSA | ( | uint | reg,
|  | int32_t | value
| ) |  |
| virtual

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

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

Reimplemented in TownScopeResolver, AirportScopeResolver, and IndustriesScopeResolver.

Definition at line 116 of file newgrf_spritegroup.cpp.

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

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