OpenTTD Source 20260206-master-g4d4e37dbf1
RoadTypeScopeResolver Struct Reference

Resolver for the railtype scope. More...

#include <newgrf_roadtype.h>

Inheritance diagram for RoadTypeScopeResolver:
ScopeResolver

Public Member Functions

 RoadTypeScopeResolver (ResolverObject &ro, const RoadTypeInfo *rti, TileIndex tile, TileContext context)
 Constructor of the roadtype scope resolvers.
uint32_t GetRandomBits () const override
 Get a few random bits.
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 GetRandomTriggers () const
 Get the triggers.
virtual void StorePSA (uint reg, int32_t value)
 Store a value into the persistent storage area (PSA).

Data Fields

TileIndex tile
 Tracktile. For track on a bridge this is the southern bridgehead.
TileContext context
 Are we resolving sprites for the upper halftile, or on a bridge?
const RoadTypeInforti
Data Fields inherited from ScopeResolver
ResolverObjectro
 Surrounding resolver object.

Detailed Description

Resolver for the railtype scope.

Definition at line 18 of file newgrf_roadtype.h.

Constructor & Destructor Documentation

◆ RoadTypeScopeResolver()

RoadTypeScopeResolver::RoadTypeScopeResolver ( ResolverObject & ro,
const RoadTypeInfo * rti,
TileIndex tile,
TileContext context )
inline

Constructor of the roadtype scope resolvers.

Parameters
roSurrounding resolver.
rtiAssociated RoadTypeInfo.
tileTile containing the track. For track on a bridge this is the southern bridgehead.
contextAre we resolving sprites for the upper halftile, or on a bridge?

Definition at line 30 of file newgrf_roadtype.h.

References context, ScopeResolver::ro, and tile.

Member Function Documentation

◆ GetRandomBits()

uint32_t RoadTypeScopeResolver::GetRandomBits ( ) const
overridevirtual

Get a few random bits.

Default implementation has no random bits.

Returns
Random bits.

Reimplemented from ScopeResolver.

Definition at line 56 of file newgrf_roadtype.cpp.

References CountBits(), GB(), tile, TILE_SIZE, TileX(), and TileY().

◆ GetVariable()

uint32_t RoadTypeScopeResolver::GetVariable ( uint8_t variable,
uint32_t parameter,
bool & available ) const
overridevirtual

Get a variable value.

Default implementation has no available variables.

Parameters
variableVariable to read
parameterParameter for 60+x variables
[out]availableSet to false, in case the variable does not exist.
Returns
Value

Reimplemented from ScopeResolver.

Definition at line 62 of file newgrf_roadtype.cpp.

References ClosestTownFromTile(), context, TimerGameCalendar::date, Debug, GetReverseRoadTypeTranslation(), GetTerrainType(), GetTownRadiusGroup(), GetTrackTypes(), INVALID_TILE, IsCrossingBarred(), IsLevelCrossingTile(), IsRoadDepotTile(), ScopeResolver::ro, tile, to_underlying(), and TownEdge.

Field Documentation

◆ context

TileContext RoadTypeScopeResolver::context

Are we resolving sprites for the upper halftile, or on a bridge?

Definition at line 20 of file newgrf_roadtype.h.

Referenced by GetVariable(), and RoadTypeScopeResolver().

◆ rti

const RoadTypeInfo* RoadTypeScopeResolver::rti

Definition at line 21 of file newgrf_roadtype.h.

◆ tile

TileIndex RoadTypeScopeResolver::tile

Tracktile. For track on a bridge this is the southern bridgehead.

Definition at line 19 of file newgrf_roadtype.h.

Referenced by GetRandomBits(), GetVariable(), and RoadTypeScopeResolver().


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