OpenTTD Source: Engine Class Reference

OpenTTD Source 15.3

Data Structures | Public Member Functions | Static Public Member Functions | Data Fields | Private Attributes
Engine Class Reference
Inheritance diagram for Engine:

## Data Structures
struct | EngineTypeFilter

## Public Member Functions
| Engine (VehicleType type, uint16_t local_id)
bool | IsEnabled () const
| Checks whether the engine is a valid (non-articulated part of an) engine.
CargoType | GetDefaultCargoType () const
| Determines the default cargo type of an engine.
uint | DetermineCapacity (const Vehicle *v, uint16_t *mail_capacity=nullptr) const
| Determines capacity of a given vehicle from scratch.
bool | CanCarryCargo () const
| Determines whether an engine can carry something.
uint | GetDisplayDefaultCapacity (uint16_t *mail_capacity=nullptr) const
| Determines the default cargo capacity of an engine for display purposes.
Money | GetRunningCost () const
| Return how much the running costs of this engine are.
Money | GetCost () const
| Return how much a new engine costs.
uint | GetDisplayMaxSpeed () const
| Returns max speed of the engine for display purposes.
uint | GetPower () const
| Returns the power of the engine for display and sorting purposes.
uint | GetDisplayWeight () const
| Returns the weight of the engine for display purposes.
uint | GetDisplayMaxTractiveEffort () const
| Returns the tractive effort of the engine for display purposes.
TimerGameCalendar::Date | GetLifeLengthInDays () const
| Returns the vehicle's (not model's!) life length in days.
uint16_t | GetRange () const
| Get the range of an aircraft type.
StringID | GetAircraftTypeText () const
| Get the name of the aircraft type for display purposes.
bool | IsHidden (CompanyID c) const
| Check whether the engine is hidden in the GUI for the given company.
const Engine * | GetDisplayVariant () const
| Get the last display variant for an engine.
bool | IsVariantHidden (CompanyID c) const
| Check whether the engine variant chain is hidden in the GUI for the given company.
bool | IsGroundVehicle () const
| Check if the engine is a ground vehicle.
const GRFFile * | GetGRF () const
| Retrieve the NewGRF the engine is tied to.
uint32_t | GetGRFID () const
| Retrieve the GRF ID of the NewGRF the engine is tied to.
template<typename T >
T & | VehInfo ()
template<typename T >
const T & | VehInfo () const
Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >
void * | operator new (size_t size)
| Allocates space for new Titem.
void * | operator new (size_t size, Tindex index)
| Allocates space for new Titem with given index.
void * | operator new (size_t, void *ptr)
| Allocates space for new Titem at given memory address.
void | operator delete (void *p, size_t size)
| Marks Titem as free.

## Static Public Member Functions
static Pool::IterateWrapperFiltered< Engine, EngineTypeFilter > | IterateType (VehicleType vt, size_t from=0)
| Returns an iterable ensemble of all valid engines of the given type.
Static Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >
static bool | CanAllocateItem (size_t n=1)
| Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
static bool | CleaningPool ()
| Returns current state of pool cleaning - yes or no.
static bool | IsValidID (auto index)
| Tests whether given index can be used to get valid (non-nullptr) Titem.
static Titem * | Get (auto index)
| Returns Titem with given index.
static Titem * | GetIfValid (auto index)
| Returns Titem with given index.
static size_t | GetPoolSize ()
| Returns first unused index.
static size_t | GetNumItems ()
| Returns number of valid items in the pool.
static void | PostDestructor (size_t index)
| Dummy function called after destructor of each member.
static Pool::IterateWrapper< Titem > | Iterate (size_t from=0)
| Returns an iterable ensemble of all valid Titem.

## Data Fields
CompanyMask | company_avail {}
| Bit for each company whether the engine is available for that company.
CompanyMask | company_hidden {}
| Bit for each company whether the engine is normally hidden in the build gui for that company.
CompanyMask | preview_asked {}
| Bit for each company which has already been offered a preview.
std::string | name {}
| Custom name of engine.
TimerGameCalendar::Date | intro_date {}
| Date of introduction of the engine.
int32_t | age = 0
| Age of the engine in months.
uint16_t | reliability = 0
| Current reliability of the engine.
uint16_t | reliability_spd_dec = 0
| Speed of reliability decay between services (per day).
uint16_t | reliability_start = 0
| Initial reliability of the engine.
uint16_t | reliability_max = 0
| Maximal reliability of the engine.
uint16_t | reliability_final = 0
| Final reliability of the engine.
uint16_t | duration_phase_1 = 0
| First reliability phase in months, increasing reliability from reliability_start to reliability_max.
uint16_t | duration_phase_2 = 0
| Second reliability phase in months, keeping reliability_max.
uint16_t | duration_phase_3 = 0
| Third reliability phase in months, decaying to reliability_final.
EngineFlags | flags {}
| Flags of the engine.
CompanyID | preview_company = CompanyID::Invalid()
| Company which is currently being offered a preview `CompanyID::Invalid()` means no company.
uint8_t | preview_wait = 0
| Daily countdown timer for timeout of offering the engine to the preview_company company.
uint8_t | original_image_index = 0
| Original vehicle image index, thus the image index of the overridden vehicle.
VehicleType | type = VEH_INVALID
| Vehicle type, ie VEH_ROAD, VEH_TRAIN, etc.
EngineDisplayFlags | display_flags {}
| NOSAVE client-side-only display flags for build engine list.
EngineID | display_last_variant = EngineID::Invalid()
| NOSAVE client-side-only last variant selected.
EngineInfo | info {}
uint16_t | list_position = 0
CargoGRFFileProps | grf_prop {}
| Link to NewGRF.
std::vector< WagonOverride > | overrides {}
std::vector< BadgeID > | badges {}
Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >
Tindex | index
| Index of this pool item.

## Private Attributes
std::variant< std::monostate, RailVehicleInfo, RoadVehicleInfo, ShipVehicleInfo, AircraftVehicleInfo > | vehicle_info {}

## Additional Inherited Members
Public Types inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >
typedef struct Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache > | Pool
| Type of the pool this item is going to be part of.

## Detailed Description

Definition at line 38 of file engine_base.h.

## Constructor & Destructor Documentation

## ◆ Engine() [1/2]

Engine::Engine | ( |  | ) |
| inline

Definition at line 80 of file engine_base.h.

## ◆ Engine() [2/2]

Engine::Engine | ( | VehicleType | type,
|  | uint16_t | local_id
| ) |  |

Definition at line 71 of file engine.cpp.

## Member Function Documentation

## ◆ CanCarryCargo()

bool Engine::CanCarryCargo | ( |  | ) | const

Determines whether an engine can carry something.

A vehicle cannot carry anything if its capacity is zero, or none of the possible cargoes is available in the climate.

Returns
  true if the vehicle can carry something.

Definition at line 167 of file engine.cpp.

References GetDefaultCargoType(), IsValidCargoType(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by AddArticulatedParts(), RefitWindow::BuildRefitList(), CmdCloneVehicle(), DetermineCapacity(), GetAvailableVehicleCargoTypes(), GetBestFittingSubType(), GetCargoSummaryOfArticulatedVehicle(), GetCargoTypesOfArticulatedVehicle(), GetNewCargoTypeForReplace(), GetVehicleDefaultCapacity(), IsEngineRefittable(), and RefitVehicle().

## ◆ DetermineCapacity()

uint Engine::DetermineCapacity | ( | const Vehicle * | v,
|  | uint16_t * | mail_capacity = `nullptr`
| ) |  | const

Determines capacity of a given vehicle from scratch.

For aircraft the main capacity is determined. Mail might be present as well.

Parameters

  v | Vehicle of interest; nullptr in purchase list
  mail_capacity | returns secondary cargo (mail) capacity of aircraft

Returns
  Capacity

Definition at line 200 of file engine.cpp.

References CALLBACK_FAILED, EngineInfo::callback_mask, CanCarryCargo(), Vehicle::cargo_subtype, Vehicle::cargo_type, CBID_VEHICLE_REFIT_CAPACITY, CT_PASSENGERS, Vehicle::engine_type, CargoSpec::Get(), GetDefaultCargoType(), GetVehicleCallback(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::index, IsCargoInClass(), IsValidCargoType(), EngineInfo::misc_flags, CargoSpec::multiplier, NoDefaultCargoMultiplier, Passengers, PROP_AIRCRAFT_MAIL_CAPACITY, PROP_AIRCRAFT_PASSENGER_CAPACITY, PROP_ROADVEH_CARGO_CAPACITY, PROP_SHIP_CARGO_CAPACITY, PROP_TRAIN_CARGO_CAPACITY, RAILVEH_MULTIHEAD, RefitCapacity, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by CmdBuildAircraft(), CmdBuildShip(), Train::ConsistChanged(), GetDisplayDefaultCapacity(), LinkRefresher::HandleRefit(), and RefitVehicle().

## ◆ GetAircraftTypeText()

StringID Engine::GetAircraftTypeText | ( |  | ) | const

Get the name of the aircraft type for display purposes.

Returns
  Aircraft type string.

Definition at line 466 of file engine.cpp.

References AIR_CTOL, and VEH_AIRCRAFT.

Referenced by DrawAircraftPurchaseInfo(), and VehicleDetailsWindow::DrawWidget().

## ◆ GetCost()

Money Engine::GetCost | ( |  | ) | const

Return how much a new engine costs.

Returns
  Cost of the engine.

Definition at line 317 of file engine.cpp.

References GetGRF(), GetPrice(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::index, PROP_AIRCRAFT_COST_FACTOR, PROP_ROADVEH_COST_FACTOR, PROP_SHIP_COST_FACTOR, PROP_TRAIN_COST_FACTOR, RAILVEH_WAGON, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by CmdBuildVehicle(), and DrawAircraftPurchaseInfo().

## ◆ GetDefaultCargoType()

CargoType Engine::GetDefaultCargoType | ( |  | ) | const
| inline

Determines the default cargo type of an engine.

Usually a valid cargo is returned, even though the vehicle has zero capacity, and can therefore not carry anything. But the cargotype is still used for livery selection etc..

Vehicles with INVALID_CARGO as default cargo are usually not available, but it can appear as default cargo of articulated parts.

Returns
  The default cargo type.

See also
  CanCarryCargo

Definition at line 95 of file engine_base.h.

Referenced by AddArticulatedParts(), CanCarryCargo(), CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRoadVehicle(), CmdBuildShip(), CmdBuildVehicle(), CmdCloneVehicle(), DetermineCapacity(), GetAvailableVehicleCargoTypes(), GetEngineLiveryScheme(), VehicleScopeResolver::GetVariable(), GetVehicleDefaultCapacity(), and IsEngineRefittable().

## ◆ GetDisplayDefaultCapacity()

uint Engine::GetDisplayDefaultCapacity | ( | uint16_t * | mail_capacity = `nullptr` | ) | const
| inline

Determines the default cargo capacity of an engine for display purposes.

For planes carrying both passenger and mail this is the passenger capacity. For multiheaded engines this is the capacity of both heads. For articulated engines use GetCapacityOfArticulatedParts

Parameters

  mail_capacity | returns secondary cargo (mail) capacity of aircraft

Returns
  The default capacity

See also
  GetDefaultCargoType

Definition at line 115 of file engine_base.h.

References DetermineCapacity().

Referenced by AircraftEngineCargoSorter(), CmdBuildVehicle(), GetVehicleDefaultCapacity(), and ShipEngineCapacitySorter().

## ◆ GetDisplayMaxSpeed()

uint Engine::GetDisplayMaxSpeed | ( |  | ) | const

Returns max speed of the engine for display purposes.

Returns
  max speed in km-ish/h

Definition at line 357 of file engine.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::index, PROP_AIRCRAFT_SPEED, PROP_ROADVEH_SPEED, PROP_SHIP_SPEED, PROP_TRAIN_SPEED, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by DrawAircraftPurchaseInfo().

## ◆ GetDisplayMaxTractiveEffort()

uint Engine::GetDisplayMaxTractiveEffort | ( |  | ) | const

Returns the tractive effort of the engine for display purposes.

For dual-headed train-engines this is the tractive effort of both heads

Returns
  tractive effort in display units kN

Definition at line 425 of file engine.cpp.

References GetDisplayWeight(), GROUND_ACCELERATION, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::index, PROP_ROADVEH_TRACTIVE_EFFORT, PROP_TRAIN_TRACTIVE_EFFORT, VEH_ROAD, and VEH_TRAIN.

## ◆ GetDisplayVariant()

const Engine * Engine::GetDisplayVariant | ( |  | ) | const
| inline

Get the last display variant for an engine.

Returns
  Engine's last display variant or engine itself if no last display variant is set.

Definition at line 144 of file engine_base.h.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::Get(), and Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::index.

Referenced by IsVariantHidden().

## ◆ GetDisplayWeight()

uint Engine::GetDisplayWeight | ( |  | ) | const

Returns the weight of the engine for display purposes.

For dual-headed train-engines this is the weight of both heads

Returns
  weight in display units metric tons

Definition at line 407 of file engine.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::index, PROP_ROADVEH_WEIGHT, PROP_TRAIN_WEIGHT, RAILVEH_MULTIHEAD, VEH_ROAD, and VEH_TRAIN.

Referenced by GetDisplayMaxTractiveEffort().

## ◆ GetGRF()

const GRFFile * Engine::GetGRF | ( |  | ) | const
| inline

Retrieve the NewGRF the engine is tied to.

This is the GRF providing the Action 3.

Returns
  NewGRF associated to the engine.

Definition at line 166 of file engine_base.h.

References grf_prop, and GRFFilePropsBase::grffile.

Referenced by Train::ConsistChanged(), DrawTrainDetails(), GetCost(), Train::GetDisplayImageWidth(), GetEngineGrfFile(), GetGRFID(), GetLoadAmount(), GetNextArticulatedPart(), GetRefitCost(), GetRefitCostFactor(), GetRoadVehLength(), GetRunningCost(), Aircraft::GetRunningCost(), RoadVehicle::GetRunningCost(), Ship::GetRunningCost(), Train::GetRunningCost(), and Vehicle::UpdateVisualEffect().

## ◆ GetGRFID()

uint32_t Engine::GetGRFID | ( |  | ) | const

Retrieve the GRF ID of the NewGRF the engine is tied to.

This is the GRF providing the Action 3.

Returns
  GRF ID of the associated NewGRF.

Definition at line 156 of file engine.cpp.

References GetGRF().

Referenced by Train::ConsistChanged(), DrawVehiclePurchaseInfo(), GetLoadAmount(), GetRoadVehLength(), ShowNewGrfVehicleError(), StartupOneEngine(), and Vehicle::UpdateVisualEffect().

## ◆ GetLifeLengthInDays()

TimerGameCalendar::Date Engine::GetLifeLengthInDays | ( |  | ) | const

Returns the vehicle's (not model's!) life length in days.

Returns
  the life length

Definition at line 442 of file engine.cpp.

References _settings_game, TimerGameConst< struct Calendar >::DAYS_IN_LEAP_YEAR, VehicleSettings::extend_vehicle_life, EngineInfo::lifelength, and GameSettings::vehicle.

Referenced by CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRoadVehicle(), CmdBuildShip(), and DrawVehiclePurchaseInfo().

## ◆ GetPower()

uint Engine::GetPower | ( |  | ) | const

Returns the power of the engine for display and sorting purposes.

Only trains and road vehicles have power

Returns
  power in display units hp

Definition at line 389 of file engine.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::index, PROP_ROADVEH_POWER, PROP_TRAIN_POWER, VEH_ROAD, and VEH_TRAIN.

Referenced by EnginePowerVsRunningCostSorter().

## ◆ GetRange()

uint16_t Engine::GetRange | ( |  | ) | const

Get the range of an aircraft type.

Returns
  Range of the aircraft type in tiles or 0 if unlimited range.

Definition at line 452 of file engine.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::index, PROP_AIRCRAFT_RANGE, and VEH_AIRCRAFT.

Referenced by DrawAircraftPurchaseInfo().

## ◆ GetRunningCost()

Money Engine::GetRunningCost | ( |  | ) | const

Return how much the running costs of this engine are.

Returns
  Yearly running cost of the engine.

Definition at line 280 of file engine.cpp.

References GetGRF(), GetPrice(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::index, PROP_AIRCRAFT_RUNNING_COST_FACTOR, PROP_ROADVEH_RUNNING_COST_FACTOR, PROP_SHIP_RUNNING_COST_FACTOR, PROP_TRAIN_RUNNING_COST_FACTOR, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by DrawAircraftPurchaseInfo(), EnginePowerVsRunningCostSorter(), and GetPreviewRunningCostString().

## ◆ IsEnabled()

bool Engine::IsEnabled | ( |  | ) | const

Checks whether the engine is a valid (non-articulated part of an) engine.

Returns
  true if enabled

Definition at line 146 of file engine.cpp.

References _settings_game, EngineInfo::climates, GameSettings::game_creation, GameCreationSettings::landscape, EngineInfo::string_id, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

Referenced by IsEngineBuildable().

## ◆ IsGroundVehicle()

bool Engine::IsGroundVehicle | ( |  | ) | const
| inline

Check if the engine is a ground vehicle.

Returns
  True iff the engine is a train or a road vehicle.

Definition at line 156 of file engine_base.h.

References VEH_ROAD, and VEH_TRAIN.

Referenced by GetArticulatedRefitMasks(), GetCapacityOfArticulatedParts(), GetCargoTypesOfArticulatedParts(), and IsArticulatedVehicleRefittable().

## ◆ IsHidden()

bool Engine::IsHidden | ( | CompanyID | c | ) | const
| inline

Check whether the engine is hidden in the GUI for the given company.

Parameters

  c | Company to check.

Returns
  `true` iff the engine is hidden in the GUI for the given company.

Definition at line 135 of file engine_base.h.

References company_hidden, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

Referenced by BuildVehicleWindow::GetWidgetString(), IsVariantHidden(), and BuildVehicleWindow::OnClick().

## ◆ IsVariantHidden()

bool Engine::IsVariantHidden | ( | CompanyID | c | ) | const

Check whether the engine variant chain is hidden in the GUI for the given company.

Parameters

  c | Company to check.

Returns
  `true` iff the engine variant chain is hidden in the GUI for the given company.

Definition at line 486 of file engine.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_engine_pool >::Get(), GetDisplayVariant(), IsHidden(), and EngineInfo::variant_id.

## ◆ IterateType()

static Pool::IterateWrapperFiltered< Engine, EngineTypeFilter > Engine::IterateType | ( | VehicleType | vt,
|  | size_t | from = `0`
| ) |  |
| inlinestatic

Returns an iterable ensemble of all valid engines of the given type.

Parameters

  vt | the VehicleType for engines to be valid
  from | index of the first engine to consider

Returns
  an iterable ensemble of all valid engines of the given type

Definition at line 197 of file engine_base.h.

Referenced by AcceptEnginePreview(), AfterLoadGRFs(), CanBuildVehicleInfrastructure(), CheckValidVehicles(), ClearLastVariant(), ReplaceVehicleWindow::GenerateReplaceVehList(), GetCompanyRailTypes(), GetCompanyRoadTypes(), GetRailTypes(), GetRoadTypes(), InitDepotWindowBlockSizes(), and ResetNewGRFData().

## ◆ VehInfo() [1/2]

template<typename T >

T & Engine::VehInfo | ( |  | ) |
| inline

Definition at line 180 of file engine_base.h.

## ◆ VehInfo() [2/2]

template<typename T >

const T & Engine::VehInfo | ( |  | ) | const
| inline

Definition at line 186 of file engine_base.h.

## Field Documentation

## ◆ age

int32_t Engine::age = 0

Age of the engine in months.

Definition at line 47 of file engine_base.h.

Referenced by CalcEngineReliability(), CopyTempEngineData(), FixTTOEngines(), and StartupOneEngine().

## ◆ badges

std::vector<BadgeID> Engine::badges {}

Definition at line 73 of file engine_base.h.

## ◆ company_avail

CompanyMask Engine::company_avail {}

Bit for each company whether the engine is available for that company.

Definition at line 40 of file engine_base.h.

Referenced by AgeVehicle(), CalcEngineReliability(), CopyTempEngineData(), DisableEngineForCompany(), EnableEngineForCompany(), FixTTOEngines(), IsEngineBuildable(), NewVehicleAvailable(), and StartupOneEngine().

## ◆ company_hidden

CompanyMask Engine::company_hidden {}

Bit for each company whether the engine is normally hidden in the build gui for that company.

Definition at line 41 of file engine_base.h.

Referenced by CmdSetVehicleVisibility(), CopyTempEngineData(), DrawEngineList(), IsHidden(), and StartupOneEngine().

## ◆ display_flags

EngineDisplayFlags Engine::display_flags {}

NOSAVE client-side-only display flags for build engine list.

Definition at line 64 of file engine_base.h.

Referenced by ReplaceVehicleWindow::GenerateReplaceVehList(), ReplaceVehicleWindow::OnClick(), and BuildVehicleWindow::OnClick().

## ◆ display_last_variant

EngineID Engine::display_last_variant = EngineID::Invalid()

NOSAVE client-side-only last variant selected.

Definition at line 65 of file engine_base.h.

Referenced by GUIEngineListAddChildren().

## ◆ duration_phase_1

uint16_t Engine::duration_phase_1 = 0

First reliability phase in months, increasing reliability from reliability_start to reliability_max.

Definition at line 54 of file engine_base.h.

Referenced by CalcEngineReliability(), CopyTempEngineData(), FixTTOEngines(), and StartupOneEngine().

## ◆ duration_phase_2

uint16_t Engine::duration_phase_2 = 0

Second reliability phase in months, keeping reliability_max.

Definition at line 55 of file engine_base.h.

Referenced by CalcEngineReliability(), CopyTempEngineData(), FixTTOEngines(), and StartupOneEngine().

## ◆ duration_phase_3

uint16_t Engine::duration_phase_3 = 0

Third reliability phase in months, decaying to reliability_final.

Definition at line 56 of file engine_base.h.

Referenced by CalcEngineReliability(), CopyTempEngineData(), FixTTOEngines(), and StartupOneEngine().

## ◆ flags

EngineFlags Engine::flags {}

Flags of the engine.

See also
  EngineFlags

Definition at line 57 of file engine_base.h.

Referenced by CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRoadVehicle(), CmdBuildShip(), CmdWantEnginePreview(), CopyTempEngineData(), FixTTOEngines(), IsEngineBuildable(), ENGNChunkHandler::Load(), NewVehicleAvailable(), and StartupOneEngine().

## ◆ grf_prop

CargoGRFFileProps Engine::grf_prop {}

Link to NewGRF.

Definition at line 71 of file engine_base.h.

Referenced by CommitVehicleListOrderChanges(), EnginePreSort(), GetGRF(), GetNewEngine(), SetEngineGRF(), VehicleLengthChanged(), and VehicleResolverObject::VehicleResolverObject().

## ◆ info

EngineInfo Engine::info {}

Definition at line 66 of file engine_base.h.

## ◆ intro_date

TimerGameCalendar::Date Engine::intro_date {}

Date of introduction of the engine.

Definition at line 46 of file engine_base.h.

Referenced by CopyTempEngineData(), DrawVehiclePurchaseInfo(), FixTTOEngines(), and StartupOneEngine().

## ◆ list_position

uint16_t Engine::list_position = 0

Definition at line 68 of file engine_base.h.

## ◆ name

std::string Engine::name {}

Custom name of engine.

Definition at line 44 of file engine_base.h.

Referenced by CmdRenameEngine(), CopyTempEngineData(), FixTTOEngines(), and ENGSChunkHandler::Load().

## ◆ original_image_index

uint8_t Engine::original_image_index = 0

Original vehicle image index, thus the image index of the overridden vehicle.

Definition at line 61 of file engine_base.h.

Referenced by Aircraft::GetImage(), RoadVehicle::GetImage(), Ship::GetImage(), and Train::GetImage().

## ◆ overrides

std::vector<WagonOverride> Engine::overrides {}

Definition at line 72 of file engine_base.h.

## ◆ preview_asked

CompanyMask Engine::preview_asked {}

Bit for each company which has already been offered a preview.

Definition at line 42 of file engine_base.h.

Referenced by AcceptEnginePreview(), CopyTempEngineData(), FixTTOEngines(), GetPreviewCompany(), and ENGNChunkHandler::Load().

## ◆ preview_company

CompanyID Engine::preview_company = CompanyID::Invalid()

Company which is currently being offered a preview `CompanyID::Invalid()` means no company.

Definition at line 59 of file engine_base.h.

Referenced by AcceptEnginePreview(), CmdWantEnginePreview(), CopyTempEngineData(), FixTTOEngines(), and ENGNChunkHandler::Load().

## ◆ preview_wait

uint8_t Engine::preview_wait = 0

Daily countdown timer for timeout of offering the engine to the preview_company company.

Definition at line 60 of file engine_base.h.

Referenced by CopyTempEngineData(), and FixTTOEngines().

## ◆ reliability

uint16_t Engine::reliability = 0

Current reliability of the engine.

Definition at line 49 of file engine_base.h.

Referenced by AircraftEventHandler_AtTerminal(), CalcEngineReliability(), CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRoadVehicle(), CmdBuildShip(), CopyTempEngineData(), DrawVehiclePurchaseInfo(), FixTTOEngines(), ProcessConditionalOrder(), and VehicleServiceInDepot().

## ◆ reliability_final

uint16_t Engine::reliability_final = 0

Final reliability of the engine.

Definition at line 53 of file engine_base.h.

Referenced by CalcEngineReliability(), CopyTempEngineData(), FixTTOEngines(), and StartupOneEngine().

## ◆ reliability_max

uint16_t Engine::reliability_max = 0

Maximal reliability of the engine.

Definition at line 52 of file engine_base.h.

Referenced by CalcEngineReliability(), CopyTempEngineData(), FixTTOEngines(), and StartupOneEngine().

## ◆ reliability_spd_dec

uint16_t Engine::reliability_spd_dec = 0

Speed of reliability decay between services (per day).

Definition at line 50 of file engine_base.h.

Referenced by CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRoadVehicle(), CmdBuildShip(), CopyTempEngineData(), FixTTOEngines(), and StartupOneEngine().

## ◆ reliability_start

uint16_t Engine::reliability_start = 0

Initial reliability of the engine.

Definition at line 51 of file engine_base.h.

Referenced by CalcEngineReliability(), CopyTempEngineData(), FixTTOEngines(), and StartupOneEngine().

## ◆ type

VehicleType Engine::type = VEH_INVALID

Vehicle type, ie VEH_ROAD, VEH_TRAIN, etc.

Definition at line 62 of file engine_base.h.

Referenced by AcceptEnginePreview(), CalcEngineReliability(), CanVehicleUseStation(), CheckAutoreplaceValidity(), CmdBuildVehicle(), CmdSetVehicleVisibility(), CommitVehicleListOrderChanges(), DisableEngineForCompany(), DrawAircraftPurchaseInfo(), DrawVehicleEngine(), DrawVehiclePurchaseInfo(), EnableEngineForCompany(), EnginePreSort(), GetEngineCategoryName(), GetEngineInfoString(), GetEngineLiveryScheme(), GetNextArticulatedPart(), GetPreviewCompany(), GetRefitCost(), IsEngineBuildable(), IsWagon(), NewVehicleAvailable(), StartupOneEngine(), GroupStatistics::UpdateAutoreplace(), Vehicle::UpdateVisualEffect(), and EnginePreviewWindow::UpdateWidgetSize().

## ◆ vehicle_info

std::variant<std::monostate, RailVehicleInfo, RoadVehicleInfo, ShipVehicleInfo, AircraftVehicleInfo> Engine::vehicle_info {}
| private

Definition at line 77 of file engine_base.h.

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

- src/engine_base.h
- src/engine.cpp