Public Member Functions | Data Fields

VehicleScopeResolver Struct Reference

Resolver for a vehicle scope. More...

#include <newgrf_engine.h>

Inheritance diagram for VehicleScopeResolver:
ScopeResolver

Public Member Functions

 VehicleScopeResolver (ResolverObject &ro, EngineID engine_type, const Vehicle *v, bool info_view)
 Scope resolver of a single vehicle.
void SetVehicle (const Vehicle *v)
uint32 GetRandomBits () const
 Get a few random bits.
uint32 GetVariable (byte variable, uint32 parameter, bool *available) const
 Get a variable value.
uint32 GetTriggers () const
 Get the triggers.
void SetTriggers (int triggers) const
 Set the triggers.

Data Fields

struct Vehiclev
 The vehicle being resolved.
EngineID self_type
 Type of the vehicle.
bool info_view
 Indicates if the item is being drawn in an info window.

Detailed Description

Resolver for a vehicle scope.

Definition at line 24 of file newgrf_engine.h.


Constructor & Destructor Documentation

VehicleScopeResolver::VehicleScopeResolver ( ResolverObject ro,
EngineID  engine_type,
const Vehicle v,
bool  info_view 
)

Scope resolver of a single vehicle.

Parameters:
ro Surrounding resolver.
engine_type Engine type
v Vehicle being resolved.
info_view Indicates if the item is being drawn in an info window.

Definition at line 953 of file newgrf_engine.cpp.

References self_type.


Member Function Documentation

uint32 VehicleScopeResolver::GetRandomBits (  )  const [virtual]

Get a few random bits.

Default implementation has no random bits.

Returns:
Random bits.

Reimplemented from ScopeResolver.

Definition at line 343 of file newgrf_engine.cpp.

References Vehicle::random_bits.

uint32 VehicleScopeResolver::GetTriggers (  )  const [virtual]

Get the triggers.

Base class returns 0 to prevent trouble.

Returns:
The triggers.

Reimplemented from ScopeResolver.

Definition at line 348 of file newgrf_engine.cpp.

References Vehicle::waiting_triggers.

uint32 VehicleScopeResolver::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 from ScopeResolver.

Definition at line 889 of file newgrf_engine.cpp.

References _cur_year, _current_company, _date, GRFFile::cargo_map, Clamp(), CargoSpec::classes, CT_INVALID, DAYS_TILL_ORIGINAL_BASE_YEAR, GB(), CargoSpec::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GetCompanyInfo(), Engine::GetDefaultCargoType(), Engine::GetGRF(), INVALID_VEHICLE, LiveryHelper(), ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR, self_type, and CargoSpec::weight.

void VehicleScopeResolver::SetTriggers ( int  triggers  )  const [virtual]

Set the triggers.

Base class implementation does nothing.

Parameters:
triggers Triggers to set.

Reimplemented from ScopeResolver.

Definition at line 353 of file newgrf_engine.cpp.

References ScopeResolver::ro, and Vehicle::waiting_triggers.


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