Functions related to engines. More...
#include "engine_type.h"#include "vehicle_type.h"#include "company_type.h"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. | |
| bool | IsEngineBuildable (EngineID engine, VehicleType type, CompanyID company) |
| Check if an engine is buildable. | |
| bool | IsEngineRefittable (EngineID engine) |
| Check if an engine is refittable. | |
| void | SetCachedEngineCounts () |
| Sets cached values in Company::num_vehicles and Group::num_vehicles. | |
| void | SetYearEngineAgingStops () |
| Compute the value for _year_engine_aging_stops. | |
| void | StartupOneEngine (Engine *e, Date aging_date) |
| uint | GetTotalCapacityOfArticulatedParts (EngineID engine) |
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.
| 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 950 of file engine.cpp.
References CompanyProperties::avail_railtypes, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_engine_pool >::GetIfValid(), GetRailTypeInfo(), HasBit(), Engine::IsEnabled(), Engine::type, and VEH_TRAIN.
Referenced by CheckAutoreplaceValidity(), CmdBuildVehicle(), GetNewEngineType(), AIEngine::IsBuildable(), and AIEngine::IsValidEngine().
| 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 980 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, Tcache, Tzero >::PoolItem<&_engine_pool >::GetIfValid(), and HasBit().
Referenced by IsArticulatedVehicleRefittable(), and IsVehicleRefitable().
| void SetYearEngineAgingStops | ( | ) |
Compute the value for _year_engine_aging_stops.
Definition at line 592 of file engine.cpp.
References _settings_game, _year_engine_aging_stops, ConvertDateToYMD(), DAYS_IN_LEAP_YEAR, GameSettings::game_creation, HasBit(), GameCreationSettings::landscape, EngineInfo::lifelength, max(), RAILVEH_WAGON, Engine::type, VEH_TRAIN, and YearMonthDay::year.
| void StartupEngines | ( | ) |
Start/initialise all our engines.
Must be called whenever there are changes to the NewGRF config.
Definition at line 657 of file engine.cpp.
References _date, _introduced_railtypes, _year_engine_aging_stops, CompanyProperties::avail_railtypes, Company::avail_roadtypes, CheckRailIntroduction(), ConvertYMDToDate(), GetCompanyRailtypes(), GetCompanyRoadtypes(), GetRailTypeInfo(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, RailtypeInfo::introduction_date, InvalidateWindowClassesData(), IsInsideMM(), RailtypeInfo::label, MAX_DAY, min(), RAILTYPE_BEGIN, and SetBit().
Referenced by _GenerateWorld(), AfterLoadGame(), DEF_CONSOLE_CMD(), and ReloadNewGRFData().
1.7.1