Public Member Functions | |
Engine (VehicleType type, EngineID base) | |
bool | IsEnabled () const |
Checks whether the engine is a valid (non-articulated part of an) engine. | |
CargoID | GetDefaultCargoType () const |
Determines the default cargo type of an engine. | |
uint | DetermineCapacity (const Vehicle *v, uint16 *mail_capacity=NULL) const |
Determines capacity of a given vehicle from scratch. | |
bool | CanCarryCargo () const |
Determines whether an engine can carry something. | |
uint | GetDisplayDefaultCapacity (uint16 *mail_capacity=NULL) 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. | |
Date | GetLifeLengthInDays () const |
Returns the vehicle's (not model's!) life length in days. | |
uint16 | GetRange () const |
Get the range of an aircraft type. | |
bool | IsGroundVehicle () const |
Check if the engine is a ground vehicle. | |
const GRFFile * | GetGRF () const |
Retrieve the NewGRF the engine is tied to. | |
uint32 | GetGRFID () const |
Retrieve the GRF ID of the NewGRF the engine is tied to. | |
Data Fields | |
char * | name |
Custom name of engine. | |
Date | intro_date |
Date of introduction of the engine. | |
Date | age |
uint16 | reliability |
Current reliability of the engine. | |
uint16 | reliability_spd_dec |
Speed of reliability decay between services (per day). | |
uint16 | reliability_start |
Initial reliability of the engine. | |
uint16 | reliability_max |
Maximal reliability of the engine. | |
uint16 | reliability_final |
Final reliability of the engine. | |
uint16 | duration_phase_1 |
First reliability phase in months, increasing reliability from reliability_start to reliability_max. | |
uint16 | duration_phase_2 |
Second reliability phase in months, keeping reliability_max. | |
uint16 | duration_phase_3 |
Third reliability phase on months, decaying to reliability_final. | |
byte | flags |
Flags of the engine. | |
CompanyMask | preview_asked |
Bit for each company which has already been offered a preview. | |
CompanyByte | preview_company |
Company which is currently being offered a preview INVALID_COMPANY means no company. | |
byte | preview_wait |
Daily countdown timer for timeout of offering the engine to the preview_company company. | |
CompanyMask | company_avail |
Bit for each company whether the engine is available for that company. | |
uint8 | original_image_index |
Original vehicle image index, thus the image index of the overridden vehicle. | |
VehicleType | type |
Vehicle type, ie VEH_ROAD, VEH_TRAIN, etc. | |
EngineInfo | info |
union { | |
RailVehicleInfo rail | |
RoadVehicleInfo road | |
ShipVehicleInfo ship | |
AircraftVehicleInfo air | |
} | u |
GRFFilePropsBase< NUM_CARGO+2 > | grf_prop |
Properties related the the grf file. | |
uint16 | overrides_count |
struct WagonOverride * | overrides |
uint16 | list_position |
Definition at line 23 of file engine_base.h.
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.
Definition at line 175 of file engine.cpp.
References GetDefaultCargoType(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by AddArticulatedParts(), RefitWindow::BuildRefitList(), CmdCloneVehicle(), DetermineCapacity(), GetAvailableVehicleCargoTypes(), GetBestFittingSubType(), GetCargoSummaryOfArticulatedVehicle(), GetNewCargoTypeForReplace(), GetPreviewCompany(), GetVehicleDefaultCapacity(), IsArticulatedVehicleCarryingDifferentCargoes(), IsEngineRefittable(), and RefitVehicle().
uint Engine::DetermineCapacity | ( | const Vehicle * | v, | |
uint16 * | mail_capacity = NULL | |||
) | const |
Determines capacity of a given vehicle from scratch.
For aircraft the main capacity is determined. Mail might be present as well.
v | Vehicle of interest; NULL in purchase list | |
mail_capacity | returns secondary cargo (mail) capacity of aircraft |
Definition at line 208 of file engine.cpp.
References CALLBACK_FAILED, EngineInfo::callback_mask, CanCarryCargo(), Vehicle::cargo_subtype, Vehicle::cargo_type, CBID_VEHICLE_REFIT_CAPACITY, CBM_VEHICLE_REFIT_CAPACITY, CC_PASSENGERS, EF_NO_DEFAULT_CARGO_MULTIPLIER, Vehicle::engine_type, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GetDefaultCargoType(), GetVehicleCallback(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::index, IsCargoInClass(), EngineInfo::misc_flags, PROP_AIRCRAFT_MAIL_CAPACITY, PROP_AIRCRAFT_PASSENGER_CAPACITY, PROP_ROADVEH_CARGO_CAPACITY, PROP_SHIP_CARGO_CAPACITY, PROP_TRAIN_CARGO_CAPACITY, RAILVEH_MULTIHEAD, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by CmdBuildAircraft(), CmdBuildShip(), Train::ConsistChanged(), GetDisplayDefaultCapacity(), LinkRefresher::HandleRefit(), and RefitVehicle().
Money Engine::GetCost | ( | ) | const |
Return how much a new engine costs.
Definition at line 323 of file engine.cpp.
References GetGRF(), GetPrice(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::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().
CargoID 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 CT_INVALID as default cargo are usually not available, but it can appear as default cargo of articulated parts.
Definition at line 80 of file engine_base.h.
Referenced by AddArticulatedParts(), CanCarryCargo(), CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRoadVehicle(), CmdBuildShip(), CmdBuildVehicle(), CmdCloneVehicle(), DetermineCapacity(), GetAvailableVehicleCargoTypes(), VehicleScopeResolver::GetVariable(), GetVehicleDefaultCapacity(), and IsEngineRefittable().
uint Engine::GetDisplayDefaultCapacity | ( | uint16 * | mail_capacity = NULL |
) | 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
mail_capacity | returns secondary cargo (mail) capacity of aircraft |
Definition at line 100 of file engine_base.h.
References DetermineCapacity().
Referenced by AircraftEngineCargoSorter(), GetVehicleDefaultCapacity(), and ShipEngineCapacitySorter().
uint Engine::GetDisplayMaxSpeed | ( | ) | const |
Returns max speed of the engine for display purposes.
Definition at line 363 of file engine.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::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.
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
Definition at line 431 of file engine.cpp.
References GetDisplayWeight(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::index, PROP_ROADVEH_TRACTIVE_EFFORT, PROP_TRAIN_TRACTIVE_EFFORT, VEH_ROAD, and VEH_TRAIN.
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
Definition at line 413 of file engine.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::index, PROP_ROADVEH_WEIGHT, PROP_TRAIN_WEIGHT, RAILVEH_MULTIHEAD, VEH_ROAD, and VEH_TRAIN.
Referenced by GetDisplayMaxTractiveEffort().
const GRFFile* Engine::GetGRF | ( | ) | const [inline] |
Retrieve the NewGRF the engine is tied to.
This is the GRF providing the Action 3.
Definition at line 128 of file engine_base.h.
References grf_prop, and GRFFilePropsBase< Tcnt >::grffile.
Referenced by CalculateRefitMasks(), Train::ConsistChanged(), FinaliseEngineArray(), GetCost(), Train::GetDisplayImageWidth(), GetEngineGrfFile(), Vehicle::GetGRF(), GetGRFID(), GetLoadAmount(), GetNextArticulatedPart(), GetRefitCost(), GetRefitCostFactor(), GetRoadVehLength(), Train::GetRunningCost(), Ship::GetRunningCost(), RoadVehicle::GetRunningCost(), GetRunningCost(), Aircraft::GetRunningCost(), VehicleScopeResolver::GetVariable(), and Vehicle::UpdateVisualEffect().
uint32 Engine::GetGRFID | ( | ) | const |
Retrieve the GRF ID of the NewGRF the engine is tied to.
This is the GRF providing the Action 3.
Definition at line 164 of file engine.cpp.
References GetGRF().
Referenced by Train::ConsistChanged(), Vehicle::GetGRFID(), GetLoadAmount(), GetRoadVehLength(), ShowNewGrfVehicleError(), and Vehicle::UpdateVisualEffect().
Date Engine::GetLifeLengthInDays | ( | ) | const |
Returns the vehicle's (not model's!) life length in days.
Definition at line 448 of file engine.cpp.
References _settings_game, DAYS_IN_LEAP_YEAR, VehicleSettings::extend_vehicle_life, EngineInfo::lifelength, and GameSettings::vehicle.
Referenced by CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRoadVehicle(), CmdBuildShip(), and DrawVehiclePurchaseInfo().
uint Engine::GetPower | ( | ) | const |
Returns the power of the engine for display and sorting purposes.
Only trains and road vehicles have power
Definition at line 395 of file engine.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::index, PROP_ROADVEH_POWER, PROP_TRAIN_POWER, VEH_ROAD, and VEH_TRAIN.
Referenced by EnginePowerVsRunningCostSorter().
uint16 Engine::GetRange | ( | ) | const |
Get the range of an aircraft type.
Definition at line 458 of file engine.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::index, PROP_AIRCRAFT_RANGE, and VEH_AIRCRAFT.
Money Engine::GetRunningCost | ( | ) | const |
Return how much the running costs of this engine are.
Definition at line 286 of file engine.cpp.
References GetGRF(), GetPrice(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::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 EnginePowerVsRunningCostSorter().
bool Engine::IsEnabled | ( | ) | const |
Checks whether the engine is a valid (non-articulated part of an) engine.
Definition at line 154 of file engine.cpp.
References _settings_game, EngineInfo::climates, GameSettings::game_creation, HasBit(), GameCreationSettings::landscape, and EngineInfo::string_id.
Referenced by CheckEngines(), EnginesMonthlyLoop(), FormatString(), and IsEngineBuildable().
bool Engine::IsGroundVehicle | ( | ) | const [inline] |
Check if the engine is a ground vehicle.
Definition at line 118 of file engine_base.h.
References type, and VEH_TRAIN.
Referenced by GetArticulatedRefitMasks(), GetCapacityOfArticulatedParts(), and IsArticulatedVehicleRefittable().
byte Engine::flags |
Flags of the engine.
Definition at line 35 of file engine_base.h.
Referenced by CheckEngines(), CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRoadVehicle(), CmdBuildShip(), CopyTempEngineData(), EnginesDailyLoop(), EnginesMonthlyLoop(), FixTTOEngines(), IsEngineBuildable(), NewVehicleAvailable(), and StartupOneEngine().
GRFFilePropsBase<NUM_CARGO + 2> Engine::grf_prop |
Properties related the the grf file.
NUM_CARGO real cargo plus two pseudo cargo sprite groups. Used for obtaining the sprite offset of custom sprites, and for evaluating callbacks.
Definition at line 59 of file engine_base.h.
Referenced by GetGRF(), GetNewEngine(), SetEngineGRF(), VehicleLengthChanged(), and VehicleResolverObject::VehicleResolverObject().