OpenTTD: VehicleResolverObject Struct Reference

OpenTTD

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

- Data Structures
- Class Hierarchy
- Data Fields

Public Types | Public Member Functions | Data Fields
VehicleResolverObject Struct Reference

Resolver for a vehicle (chain) More...

`#include <newgrf_engine.h>`

Inheritance diagram for VehicleResolverObject:

## Public Types
enum | WagonOverride { WO_NONE, WO_UNCACHED, WO_CACHED, WO_SELF }
| Application of 'wagon overrides'. More...

## Public Member Functions
| VehicleResolverObject (EngineID engine_type, const Vehicle *v, WagonOverride wagon_override, bool info_view=false, CallbackID callback=CBID_NO_CALLBACK, uint32 callback_param1=0, uint32 callback_param2=0)
| Resolver of a vehicle (chain).
ScopeResolver * | GetScope (VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0)
| Get a resolver for the scope.
const SpriteGroup * | ResolveReal (const RealSpriteGroup *group) const
| Get the real sprites of the grf.
Public Member Functions inherited from ResolverObject
| ResolverObject (const GRFFile *grffile, CallbackID callback=CBID_NO_CALLBACK, uint32 callback_param1=0, uint32 callback_param2=0)
| Resolver constructor.
const SpriteGroup * | Resolve ()
| Resolve SpriteGroup.
uint16 | ResolveCallback ()
| Resolve callback.
uint32 | GetRemainingTriggers () const
| Returns the waiting triggers that did not trigger any rerandomisation.
uint32 | GetReseedSum () const
| Returns the OR-sum of all bits that need reseeding independent of the scope they were accessed with.
void | ResetState ()
| Resets the dynamic state of the resolver object.

## Data Fields
VehicleScopeResolver | self_scope
| Scope resolver for the indicated vehicle.
VehicleScopeResolver | parent_scope
| Scope resolver for its parent vehicle.
VehicleScopeResolver | relative_scope
| Scope resolver for an other vehicle in the chain.
byte | cached_relative_count
| Relative position of the other vehicle.
Data Fields inherited from ResolverObject
ScopeResolver | default_scope
| Default implementation of the grf scope.
CallbackID | callback
| Callback being resolved.
uint32 | callback_param1
| First parameter (var 10) of the callback.
uint32 | callback_param2
| Second parameter (var 18) of the callback.
uint32 | last_value
| Result of most recent DeterministicSpriteGroup (including procedure calls)
uint32 | waiting_triggers
| Waiting triggers to be used by any rerandomisation. (scope independent)
uint32 | used_triggers
| Subset of cur_triggers, which actually triggered some rerandomisation. (scope independent)
uint32 | reseed [VSG_END]
| Collects bits to rerandomise while triggering triggers.
const GRFFile * | grffile
| GRFFile the resolved SpriteGroup belongs to.
const SpriteGroup * | root_spritegroup
| Root SpriteGroup to use for resolving.

## Detailed Description

Resolver for a vehicle (chain)

Definition at line 49 of file newgrf_engine.h.

## Member Enumeration Documentation

enum VehicleResolverObject::WagonOverride

Application of 'wagon overrides'.

Enumerator:

  WO_NONE | Resolve no wagon overrides.
  WO_UNCACHED | Resolve wagon overrides.
  WO_CACHED | Resolve wagon overrides using TrainCache::cached_override.
  WO_SELF | Resolve self-override (helicopter rotors and such).

Definition at line 51 of file newgrf_engine.h.

## Constructor & Destructor Documentation

VehicleResolverObject::VehicleResolverObject | ( | EngineID | engine_type,
|  | const Vehicle * | v,
|  | WagonOverride | wagon_override,
|  | bool | info_view = `false`,
|  | CallbackID | callback = `CBID_NO_CALLBACK`,
|  | uint32 | callback_param1 = `0`,
|  | uint32 | callback_param2 = `0`
| ) |  |

Resolver of a vehicle (chain).

Parameters

  engine_type | Engine type
  v | Vehicle being resolved.
  wagon_override | Application of wagon overrides.
  info_view | Indicates if the item is being drawn in an info window.
  callback | Callback ID.
  callback_param1 | First parameter (var 10) of the callback.
  callback_param2 | Second parameter (var 18) of the callback.

Definition at line 961 of file newgrf_engine.cpp.

References Vehicle::cargo_type, Vehicle::engine_type, GroundVehicleCache::first_engine, SpecializedVehicle< Train, Type >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), Vehicle::GetGroundVehicleCache(), Engine::grf_prop, Vehicle::IsGroundVehicle(), lengthof, ResolverObject::root_spritegroup, GRFFilePropsBase< Tcnt >::spritegroup, BaseVehicle::type, VEH_TRAIN, WO_CACHED, WO_NONE, and WO_SELF.

## Member Function Documentation

ScopeResolver * VehicleResolverObject::GetScope | ( | VarSpriteGroupScope | scope = `VSG_SCOPE_SELF`,
|  | byte | relative = `0`
| ) |  |
| virtual

Get a resolver for the scope.

Parameters

  scope | Scope to return.
  relative | Additional parameter for VSG_SCOPE_RELATIVE.

Returns
  The resolver for the requested scope.

Reimplemented from ResolverObject.

Definition at line 351 of file newgrf_engine.cpp.

References Vehicle::First(), GB(), GetRegister(), Vehicle::Move(), Vehicle::Next(), parent_scope, relative_scope, self_scope, VehicleScopeResolver::v, VSG_SCOPE_PARENT, VSG_SCOPE_RELATIVE, and VSG_SCOPE_SELF.

Referenced by FillNewGRFVehicleCache().

const SpriteGroup * VehicleResolverObject::ResolveReal | ( | const RealSpriteGroup * | group | ) | const
| virtual

Get the real sprites of the grf.

Parameters

  group | Group to get.

Returns
  The available sprite group.

Reimplemented from ResolverObject.

Definition at line 918 of file newgrf_engine.cpp.

References Vehicle::cargo, Vehicle::cargo_cap, Vehicle::current_order, Vehicle::First(), Order::IsType(), RealSpriteGroup::loaded, RealSpriteGroup::loading, max(), min(), RealSpriteGroup::num_loaded, RealSpriteGroup::num_loading, self_scope, VehicleCargoList::StoredCount(), and VehicleScopeResolver::v.

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

- src/newgrf_engine.h
- src/newgrf_engine.cpp