OpenTTD Source: ObjectScopeResolver Struct Reference

OpenTTD Source 15.3

Public Member Functions | Data Fields
ObjectScopeResolver Struct Reference

Object scope resolver. More...

`#include <newgrf_object.h>`

Inheritance diagram for ObjectScopeResolver:

## Public Member Functions
| ObjectScopeResolver (ResolverObject &ro, Object *obj, const ObjectSpec *spec, TileIndex tile, uint8_t view=0)
| Constructor of an object scope resolver.
uint32_t | GetRandomBits () const override
| Get a few random bits.
uint32_t | GetVariable (uint8_t variable, uint32_t parameter, bool &available) const override
| Used by the resolver to get values for feature 0F deterministic spritegroups.
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
struct Object * | obj
| The object the callback is ran for.
const ObjectSpec * | spec
| Specification of the object type.
TileIndex | tile
| The tile related to the object.
uint8_t | view
| The view of the object.
Data Fields inherited from ScopeResolver
ResolverObject & | ro
| Surrounding resolver object.

## Detailed Description

Object scope resolver.

Definition at line 111 of file newgrf_object.h.

## Constructor & Destructor Documentation

## ◆ ObjectScopeResolver()

ObjectScopeResolver::ObjectScopeResolver | ( | ResolverObject & | ro,
|  | Object * | obj,
|  | const ObjectSpec * | spec,
|  | TileIndex | tile,
|  | uint8_t | view = `0`
| ) |  |
| inline

Constructor of an object scope resolver.

Parameters

  ro | Surrounding resolver.
  obj | Object being resolved.
  tile | Tile of the object.
  view | View of the object.

Definition at line 124 of file newgrf_object.h.

## Member Function Documentation

## ◆ GetRandomBits()

uint32_t ObjectScopeResolver::GetRandomBits | ( |  | ) | const
| overridevirtual

Get a few random bits.

Default implementation has no random bits.

Returns
  Random bits.

Reimplemented from ScopeResolver.

Definition at line 159 of file newgrf_object.cpp.

References GetObjectRandomBits(), IsTileType(), IsValidTile(), MP_OBJECT, and tile.

## ◆ GetVariable()

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

Used by the resolver to get values for feature 0F deterministic spritegroups.

Reimplemented from ScopeResolver.

Definition at line 262 of file newgrf_object.cpp.

References _current_company, Object::build_date, ClosestTownFromTile(), Object::colour, TimerGameCalendar::date, Debug, DistanceManhattan(), DistanceSquare(), GetAnimationFrame(), GetBadgeVariableResult(), Object::GetByTile(), GetCountAndDistanceOfClosestInstance(), GetNearbyObjectTileInformation(), GetNearbyTile(), GetObjectIDAtOffset(), GetObjectRandomBits(), GetTerrainType(), GetTileOwner(), GetTileSlope(), GetTownRadiusGroup(), ResolverObject::grffile, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, IsTileType(), IsValidTile(), Object::location, MP_OBJECT, obj, ScopeResolver::ro, tile, OrthogonalTileArea::tile, TileX(), TileY(), to_underlying(), Object::town, view, Object::view, and Town::xy.

## Field Documentation

## ◆ obj

struct Object* ObjectScopeResolver::obj

The object the callback is ran for.

Definition at line 112 of file newgrf_object.h.

Referenced by ObjectResolverObject::GetTown(), and GetVariable().

## ◆ spec

const ObjectSpec* ObjectScopeResolver::spec

Specification of the object type.

Definition at line 113 of file newgrf_object.h.

Referenced by ObjectResolverObject::GetDebugID().

## ◆ tile

TileIndex ObjectScopeResolver::tile

The tile related to the object.

Definition at line 114 of file newgrf_object.h.

Referenced by GetRandomBits(), ObjectResolverObject::GetTown(), and GetVariable().

## ◆ view

uint8_t ObjectScopeResolver::view

The view of the object.

Definition at line 115 of file newgrf_object.h.

Referenced by GetVariable().

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

- src/newgrf_object.h
- src/newgrf_object.cpp