OpenTTD Source  13.2.1
engine_func.h File Reference
#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. 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 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. More...
 
void StartupOneEngine (Engine *e, Date aging_date, uint32 seed)
 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.
 

Detailed Description

Functions related to engines.

Definition in file engine_func.h.

Function Documentation

◆ CalcEngineReliability()

◆ 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 164 of file engine_gui.cpp.

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

Referenced by RoadVehEngineCapacitySorter().

◆ IsEngineBuildable()

◆ IsEngineRefittable()

bool IsEngineRefittable ( EngineID  engine)

◆ StartupEngines()

void StartupEngines ( )

Start/initialise all our engines.

Must be called whenever there are changes to the NewGRF config.

Definition at line 719 of file engine.cpp.

References _date, _year_engine_aging_stops, and ConvertYMDToDate().

Referenced by DEF_CONSOLE_CMD().

◆ StartupOneEngine()

void StartupOneEngine ( Engine e,
Date  aging_date,
uint32  seed 
)

Start/initialise one engine.

Parameters
eThe engine to initialise.
aging_dateThe date used for age calculations.
seedRandom seed.

Definition at line 653 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.