OpenTTD Source 20241224-master-gee860a5c8e
engine_func.h File Reference

Functions related to engines. More...

#include "engine_type.h"
#include "vehicle_type.h"
#include "company_type.h"
#include "timer/timer_game_calendar.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.
 
void CheckEngines ()
 Check for engines that have an appropriate availability.
 
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 SetYearEngineAgingStops ()
 Compute the value for _year_engine_aging_stops.
 
void CalcEngineReliability (Engine *e, bool new_month)
 Update Engine::reliability and (if needed) update the engine GUIs.
 
void StartupOneEngine (Engine *e, const TimerGameCalendar::YearMonthDay &aging_ymd, uint32_t seed)
 Start/initialise one engine.
 
uint GetTotalCapacityOfArticulatedParts (EngineID engine)
 Get the capacity of an engine with articulated parts.
 

Variables

const uint8_t _engine_counts [4]
 Number of engines of each vehicle type in original engine data.
 
const uint8_t _engine_offsets [4]
 Offset of the first engine of each vehicle type in original engine data.
 

Detailed Description

Functions related to engines.

Definition in file engine_func.h.

Function Documentation

◆ CalcEngineReliability()

◆ CheckEngines()

void CheckEngines ( )

◆ GetTotalCapacityOfArticulatedParts()

uint GetTotalCapacityOfArticulatedParts ( EngineID  engine)

Get the capacity of an engine with articulated parts.

Parameters
engineThe engine to get the capacity of.
Returns
The capacity.

Definition at line 165 of file engine_gui.cpp.

References GetCapacityOfArticulatedParts(), and CargoArray::GetSum().

Referenced by RoadVehEngineCapacitySorter(), and TrainEngineCapacitySorter().

◆ IsEngineBuildable()

◆ IsEngineRefittable()

bool IsEngineRefittable ( EngineID  engine)

◆ SetupEngines()

void SetupEngines ( )

Initialise the engine pool with the data from the original vehicles.

Definition at line 601 of file engine.cpp.

References _engine_counts, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::CleanPool(), CloseWindowByClass(), VEH_COMPANY_END, and WC_ENGINE_PREVIEW.

Referenced by ResetNewGRFData().

◆ SetYearEngineAgingStops()

◆ StartupEngines()

◆ StartupOneEngine()

Variable Documentation

◆ _engine_counts

const uint8_t _engine_counts[4]
extern

Number of engines of each vehicle type in original engine data.

Definition at line 54 of file engine.cpp.

Referenced by GetNewEngine(), ParamSet(), EngineOverrideManager::ResetToDefaultMapping(), and SetupEngines().

◆ _engine_offsets

const uint8_t _engine_offsets[4]
extern

Offset of the first engine of each vehicle type in original engine data.

Definition at line 62 of file engine.cpp.

Referenced by ParamSet().