OpenTTD Source
1.11.2
|
Go to the source code of this file.
Functions | |
void | SetupEngines () |
Initialise the engine pool with the data from the original vehicles. | |
void | StartupEngines () |
Start/initialise all our engines. More... | |
void | CheckEngines () |
Check for engines that have an appropriate availability. | |
bool | IsEngineBuildable (EngineID engine, VehicleType type, CompanyID company) |
Check if an engine is buildable. More... | |
bool | IsEngineRefittable (EngineID engine) |
Check if an engine is refittable. More... | |
void | GetArticulatedVehicleCargoesAndRefits (EngineID engine, CargoArray *cargoes, CargoTypes *refits, CargoID cargo_type, uint cargo_capacity) |
Get the default cargoes and refits of an articulated vehicle. More... | |
void | SetYearEngineAgingStops () |
Compute the value for _year_engine_aging_stops. | |
void | StartupOneEngine (Engine *e, Date aging_date) |
Start/initialise one engine. More... | |
uint | GetTotalCapacityOfArticulatedParts (EngineID engine) |
Get the capacity of an engine with articulated parts. More... | |
Variables | |
const uint8 | _engine_counts [4] |
Number of engines of each vehicle type in original engine data. | |
const uint8 | _engine_offsets [4] |
Offset of the first engine of each vehicle type in original engine data. | |
Functions related to engines.
Definition in file engine_func.h.
void GetArticulatedVehicleCargoesAndRefits | ( | EngineID | engine, |
CargoArray * | cargoes, | ||
CargoTypes * | refits, | ||
CargoID | cargo_type, | ||
uint | cargo_capacity | ||
) |
Get the default cargoes and refits of an articulated vehicle.
The refits are linked to a cargo rather than an articulated part to prevent a long list of parts.
engine | Model to investigate. | |
[out] | cargoes | Total amount of units that can be transported, summed by cargo. |
[out] | refits | Whether a (possibly partial) refit for each cargo is possible. |
cargo_type | Selected refitted cargo type | |
cargo_capacity | Capacity of selected refitted cargo type |
Definition at line 172 of file articulated_vehicles.cpp.
References EngineInfo::callback_mask, CBM_VEHICLE_ARTIC_ENGINE, CargoArray::Clear(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GetNextArticulatedPart(), GetVehicleDefaultCapacity(), HasBit(), INVALID_ENGINE, IsEngineRefittable(), Engine::IsGroundVehicle(), MAX_ARTICULATED_PARTS, and SetBit().
uint GetTotalCapacityOfArticulatedParts | ( | EngineID | engine | ) |
Get the capacity of an engine with articulated parts.
engine | The engine to get the capacity of. |
Definition at line 163 of file engine_gui.cpp.
References GetCapacityOfArticulatedParts(), and CargoArray::GetSum().
Referenced by RoadVehEngineCapacitySorter().
bool IsEngineBuildable | ( | EngineID | engine, |
VehicleType | type, | ||
CompanyID | company | ||
) |
Check if an engine is buildable.
engine | index of the engine to check. |
type | the type the engine should be. |
company | index of the company. |
Definition at line 1127 of file engine.cpp.
References Company::avail_railtypes, Company::avail_roadtypes, Engine::company_avail, ENGINE_AVAILABLE, Engine::flags, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::GetIfValid(), GetRailTypeInfo(), GetRoadTypeInfo(), HasBit(), Engine::IsEnabled(), OWNER_DEITY, RoadTypeInfo::powered_roadtypes, RoadVehicleInfo::roadtype, ROADTYPES_NONE, Engine::type, VEH_ROAD, and VEH_TRAIN.
Referenced by CheckAutoreplaceValidity(), CmdBuildVehicle(), CmdSetVehicleVisibility(), and GetNewEngineType().
bool IsEngineRefittable | ( | EngineID | engine | ) |
Check if an engine is refittable.
Note: Likely you want to use IsArticulatedVehicleRefittable().
engine | index of the engine to check. |
Definition at line 1168 of file engine.cpp.
References EngineInfo::callback_mask, Engine::CanCarryCargo(), CBM_VEHICLE_CARGO_SUFFIX, CT_INVALID, Engine::GetDefaultCargoType(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::GetIfValid(), HasBit(), and SetBit().
Referenced by GetArticulatedVehicleCargoesAndRefits(), IsArticulatedVehicleRefittable(), IsVehicleRefitable(), and OrdersWindow::UpdateAutoRefitState().
void StartupEngines | ( | ) |
Start/initialise all our engines.
Must be called whenever there are changes to the NewGRF config.
Definition at line 694 of file engine.cpp.
References _date, _year_engine_aging_stops, ConvertYMDToDate(), GetCompanyRailtypes(), GetCompanyRoadTypes(), InvalidateWindowClassesData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Iterate(), StartupOneEngine(), and WC_BUILD_VEHICLE.
Referenced by DEF_CONSOLE_CMD().
Start/initialise one engine.
e | The engine to initialise. |
aging_date | The date used for age calculations. |
Definition at line 638 of file engine.cpp.
References _settings_game, EngineInfo::base_intro, Engine::company_avail, Engine::company_hidden, Engine::flags, GameSettings::game_creation, GameCreationSettings::generation_seed, Engine::GetGRFID(), SaveRandomSeeds(), SetRandomSeed(), and Engine::type.
Referenced by StartupEngines().