Public Member Functions | |
Engine (VehicleType type, EngineID base) | |
CargoID | GetDefaultCargoType () const |
Determines the default cargo type of an engine. | |
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 |
Money | GetCost () const |
uint | GetDisplayMaxSpeed () const |
Returns max speed for display purposes. | |
uint | GetPower () const |
uint | GetDisplayWeight () const |
Returns the weight for display purposes. | |
uint | GetDisplayMaxTractiveEffort () const |
Returns the tractive effort for display purposes. | |
Date | GetLifeLengthInDays () const |
Returns the vehicle's life length in days. | |
Data Fields | |
char * | name |
Custom name of engine. | |
Date | intro_date |
Date | age |
uint16 | reliability |
uint16 | reliability_spd_dec |
uint16 | reliability_start |
uint16 | reliability_max |
uint16 | reliability_final |
uint16 | duration_phase_1 |
uint16 | duration_phase_2 |
uint16 | duration_phase_3 |
byte | flags |
uint8 | preview_company_rank |
byte | preview_wait |
CompanyMask | company_avail |
uint8 | original_image_index |
Original vehicle image index, thus the image index of the overridden vehicle. | |
VehicleType | type |
type, ie VEH_ROAD, VEH_TRAIN, etc. | |
EngineInfo | info |
union { | |
RailVehicleInfo rail | |
RoadVehicleInfo road | |
ShipVehicleInfo ship | |
AircraftVehicleInfo air | |
} | u |
struct GRFFile * | grffile |
struct SpriteGroup * | group [NUM_CARGO+2] |
uint16 | internal_id |
ID within the GRF file. | |
uint16 | overrides_count |
struct WagonOverride * | overrides |
uint16 | list_position |
Definition at line 24 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 cargos is available in the climate.
Definition at line 135 of file engine.cpp.
References CT_INVALID, GetDefaultCargoType(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by BuildRefitList(), CmdCloneVehicle(), GetBestFittingSubType(), GetDisplayDefaultCapacity(), GetVehicleCapacity(), GetVehicleDefaultCapacity(), IsEngineRefittable(), and RefitVehicle().
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 usally not available, but it can appear as default cargo of articulated parts.
Definition at line 71 of file engine_base.h.
Referenced by CanCarryCargo(), CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRoadVeh(), CmdBuildShip(), CmdCloneVehicle(), GetDisplayDefaultCapacity(), GetEngineLivery(), GetVehicleCapacity(), GetVehicleDefaultCapacity(), and IsEngineRefittable().
uint Engine::GetDisplayDefaultCapacity | ( | uint16 * | mail_capacity = NULL |
) | const |
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 172 of file engine.cpp.
References CanCarryCargo(), CC_PASSENGERS, GetDefaultCargoType(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_engine_pool >::index, IsCargoInClass(), 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 AIEventEnginePreview::GetCapacity(), AIEngine::GetCapacity(), and GetVehicleDefaultCapacity().
uint Engine::GetDisplayMaxSpeed | ( | ) | const |
Returns max speed for display purposes.
Definition at line 279 of file engine.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_engine_pool >::index, PROP_SHIP_SPEED, PROP_TRAIN_SPEED, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by AIEventEnginePreview::GetMaxSpeed(), and AIEngine::GetMaxSpeed().
uint Engine::GetDisplayMaxTractiveEffort | ( | ) | const |
Returns the tractive effort for display purposes.
For dual-headed train-engines this is the tractive effort of both heads
Definition at line 330 of file engine.cpp.
References GetDisplayWeight(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_engine_pool >::index, PROP_TRAIN_TRACTIVE_EFFORT, and VEH_TRAIN.
uint Engine::GetDisplayWeight | ( | ) | const |
Returns the weight for display purposes.
For dual-headed train-engines this is the weight of both heads
Definition at line 314 of file engine.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_engine_pool >::index, PROP_TRAIN_WEIGHT, RAILVEH_MULTIHEAD, and VEH_TRAIN.
Referenced by GetDisplayMaxTractiveEffort().
Date Engine::GetLifeLengthInDays | ( | ) | const |
Returns the vehicle's life length in days.
Definition at line 345 of file engine.cpp.
References _settings_game, DAYS_IN_LEAP_YEAR, VehicleSettings::extend_vehicle_life, and GameSettings::vehicle.
Referenced by CmdBuildAircraft(), CmdBuildRailVehicle(), CmdBuildRoadVeh(), CmdBuildShip(), and DrawVehiclePurchaseInfo().