OpenTTD Source 20241224-master-gf74b0cf984
engines.h File Reference

This file contains all the data for vehicles. More...

Go to the source code of this file.

Macros

#define MT(a, b, c, d, e, f)   { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, INVALID_CARGO, e, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }
 Writes the properties of a train into the EngineInfo struct.
 
#define MM(a, b, c, d, e, f)   { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, INVALID_CARGO, e, 0, 8, 1 << EF_RAIL_IS_MU, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }
 Writes the properties of a multiple-unit train into the EngineInfo struct.
 
#define MW(a, b, c, d, e, f)   { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, INVALID_CARGO, e, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }
 Writes the properties of a train carriage into the EngineInfo struct.
 
#define MR(a, b, c, d, e, f)   { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, INVALID_CARGO, e, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }
 Writes the properties of a road vehicle into the EngineInfo struct.
 
#define MS(a, b, c, d, e, f)   { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 10, f, INVALID_CARGO, e, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }
 Writes the properties of a ship into the EngineInfo struct.
 
#define MA(a, b, c, d, e)   { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 20, e, INVALID_CARGO, CT_INVALID, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }
 Writes the properties of an aeroplane into the EngineInfo struct.
 
#define T   1
 
#define A   2
 
#define S   4
 
#define Y   8
 
#define RVI(a, b, c, d, e, f, g, h, i, j, k)   { a, b, c, j, j, 0, d, e, f, g, h, k, i, 0, 0, VE_DEFAULT, 0, 76, 0, 0, 0 }
 Writes the properties of a rail vehicle into the RailVehicleInfo struct.
 
#define M   RAILVEH_MULTIHEAD
 
#define W   RAILVEH_WAGON
 
#define G   RAILVEH_SINGLEHEAD
 
#define S   EC_STEAM
 
#define D   EC_DIESEL
 
#define E   EC_ELECTRIC
 
#define N   EC_MONORAIL
 
#define V   EC_MAGLEV
 
#define A   EC_STEAM
 
#define R   RAILTYPE_RAIL
 
#define C   RAILTYPE_ELECTRIC
 
#define O   RAILTYPE_MONO
 
#define L   RAILTYPE_MAGLEV
 
#define RC_S   PR_RUNNING_TRAIN_STEAM
 
#define RC_D   PR_RUNNING_TRAIN_DIESEL
 
#define RC_E   PR_RUNNING_TRAIN_ELECTRIC
 
#define RC_W   INVALID_PRICE
 
#define SVI(a, b, c, d, e, f, g, h)   { a, b, f, c, d, e, g, h, VE_DEFAULT, 0, 0 }
 Writes the properties of a ship into the ShipVehicleInfo struct.
 
#define AVI(a, b, c, d, e, f, g, h, i)   { a, b, c, d, e, (g * 128) / 10, f, h, i, 0 }
 Writes the properties of an aircraft into the AircraftVehicleInfo struct.
 
#define H   AIR_HELI
 
#define P   AIR_CTOL
 
#define J   AIR_CTOL | AIR_FAST
 
#define ROV(a, b, c, d, e, f, g, h)   { a, b, c, PR_RUNNING_ROADVEH, d, e, f, g, h, 76, 0, VE_DEFAULT, 0, ROADTYPE_ROAD }
 Writes the properties of a road vehicle into the RoadVehicleInfo struct.
 

Variables

static constexpr EngineInfo _orig_engine_info []
 
static constexpr RailVehicleInfo _orig_rail_vehicle_info []
 
static constexpr ShipVehicleInfo _orig_ship_vehicle_info []
 
static constexpr AircraftVehicleInfo _orig_aircraft_vehicle_info []
 
static constexpr RoadVehicleInfo _orig_road_vehicle_info []
 

Detailed Description

This file contains all the data for vehicles.

Definition in file engines.h.

Macro Definition Documentation

◆ A [1/2]

#define A   2

Definition at line 97 of file engines.h.

◆ A [2/2]

#define A   EC_STEAM

Definition at line 97 of file engines.h.

◆ AVI

#define AVI (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)    { a, b, c, d, e, (g * 128) / 10, f, h, i, 0 }

Writes the properties of an aircraft into the AircraftVehicleInfo struct.

See also
AircraftVehicleInfo
Parameters
aimage_index
bcost_factor
crunning_Cost
dsubtype (bit 0 - plane, bit 1 - large plane)
esound effect
facceleration (1 unit = 3/8 mph/tick = 3/5 km-ish/h/tick) (stays the same in the variable)
gmax_speed (1 unit = 8 mph = 12.8 km-ish/h) (is converted to km-ish/h by the macro)
hmail_capacity (bags)
ipassenger_capacity (persons)

Definition at line 600 of file engines.h.

◆ C

#define C   RAILTYPE_ELECTRIC

Definition at line 402 of file engines.h.

◆ D

#define D   EC_DIESEL

Definition at line 394 of file engines.h.

◆ E

#define E   EC_ELECTRIC

Definition at line 395 of file engines.h.

◆ G

#define G   RAILVEH_SINGLEHEAD

Definition at line 392 of file engines.h.

◆ H

#define H   AIR_HELI

Definition at line 601 of file engines.h.

◆ J

#define J   AIR_CTOL | AIR_FAST

Definition at line 603 of file engines.h.

◆ L

#define L   RAILTYPE_MAGLEV

Definition at line 404 of file engines.h.

◆ M

#define M   RAILVEH_MULTIHEAD

Definition at line 390 of file engines.h.

◆ MA

#define MA (   a,
  b,
  c,
  d,
 
)    { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 20, e, INVALID_CARGO, CT_INVALID, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }

Writes the properties of an aeroplane into the EngineInfo struct.

Parameters
abase introduction date (days since 1920-01-01)
bdecay speed
clife length (years)
dbase life (years)
eBitmask of the climates
Note
the 20 between b and e is the load amount

Definition at line 89 of file engines.h.

◆ MM

#define MM (   a,
  b,
  c,
  d,
  e,
 
)    { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, INVALID_CARGO, e, 0, 8, 1 << EF_RAIL_IS_MU, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }

Writes the properties of a multiple-unit train into the EngineInfo struct.

See also
EngineInfo
Parameters
abase introduction date (days since 1920-01-01)
bdecay speed
clife length (years)
dbase life (years)
ecargo type
fBitmask of the climates
Note
the 5 between b and f is the load amount

Definition at line 40 of file engines.h.

◆ MR

#define MR (   a,
  b,
  c,
  d,
  e,
 
)    { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, INVALID_CARGO, e, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }

Writes the properties of a road vehicle into the EngineInfo struct.

See also
EngineInfo
Parameters
abase introduction date (days since 1920-01-01)
bdecay speed
clife length (years)
dbase life (years)
ecargo type
fBitmask of the climates
Note
the 5 between b and f is the load amount

Definition at line 66 of file engines.h.

◆ MS

#define MS (   a,
  b,
  c,
  d,
  e,
 
)    { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 10, f, INVALID_CARGO, e, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }

Writes the properties of a ship into the EngineInfo struct.

Parameters
abase introduction date (days since 1920-01-01)
bdecay speed
clife length (years)
dbase life (years)
ecargo type
fBitmask of the climates
Note
the 10 between b and f is the load amount

Definition at line 78 of file engines.h.

◆ MT

#define MT (   a,
  b,
  c,
  d,
  e,
 
)    { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, INVALID_CARGO, e, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }

Writes the properties of a train into the EngineInfo struct.

See also
EngineInfo
Parameters
abase introduction date (days since 1920-01-01)
bdecay speed
clife length (years)
dbase life (years)
ecargo type
fBitmask of the climates
Note
the 5 between b and f is the load amount

Definition at line 27 of file engines.h.

◆ MW

#define MW (   a,
  b,
  c,
  d,
  e,
 
)    { CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, INVALID_CARGO, e, 0, 8, 0, 0, 0, ExtraEngineFlags::None, STR_EMPTY, Ticks::CARGO_AGING_TICKS, INVALID_ENGINE }

Writes the properties of a train carriage into the EngineInfo struct.

Parameters
abase introduction date (days since 1920-01-01)
bdecay speed
clife length (years)
dbase life (years)
ecargo type
fBitmask of the climates
See also
MT
Note
the 5 between b and f is the load amount

Definition at line 53 of file engines.h.

◆ N

#define N   EC_MONORAIL

Definition at line 396 of file engines.h.

◆ O

#define O   RAILTYPE_MONO

Definition at line 403 of file engines.h.

◆ P

#define P   AIR_CTOL

Definition at line 602 of file engines.h.

◆ R

#define R   RAILTYPE_RAIL

Definition at line 401 of file engines.h.

◆ RC_D

#define RC_D   PR_RUNNING_TRAIN_DIESEL

Definition at line 407 of file engines.h.

◆ RC_E

#define RC_E   PR_RUNNING_TRAIN_ELECTRIC

Definition at line 408 of file engines.h.

◆ RC_S

#define RC_S   PR_RUNNING_TRAIN_STEAM

Definition at line 406 of file engines.h.

◆ RC_W

#define RC_W   INVALID_PRICE

Definition at line 409 of file engines.h.

◆ ROV

#define ROV (   a,
  b,
  c,
  d,
  e,
  f,
  g,
 
)    { a, b, c, PR_RUNNING_ROADVEH, d, e, f, g, h, 76, 0, VE_DEFAULT, 0, ROADTYPE_ROAD }

Writes the properties of a road vehicle into the RoadVehicleInfo struct.

See also
RoadVehicleInfo
Parameters
aimage_index
bcost_factor
crunning_cost
dsound effect
emax_speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)
fcapacity (persons, bags, tons, pieces, items, cubic metres, ...)
gweight (1/4 ton)
hpower (10 hp) Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76 Air drag value depends on the top speed of the vehicle.

Definition at line 671 of file engines.h.

◆ RVI

#define RVI (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j,
 
)    { a, b, c, j, j, 0, d, e, f, g, h, k, i, 0, 0, VE_DEFAULT, 0, 76, 0, 0, 0 }

Writes the properties of a rail vehicle into the RailVehicleInfo struct.

See also
RailVehicleInfo
Parameters
aimage_index
btype
ccost_factor
dmax_speed (1 unit = 1/1.6 mph = 1 km-ish/h)
epower (hp)
fweight (tons)
grunning_cost
hrunning_cost_class
icapacity (persons, bags, tons, pieces, items, cubic metres, ...)
jrailtype
kengclass Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76 Air drag value depends on the top speed of the vehicle.

Definition at line 389 of file engines.h.

◆ S [1/2]

#define S   4

Definition at line 98 of file engines.h.

◆ S [2/2]

#define S   EC_STEAM

Definition at line 98 of file engines.h.

◆ SVI

#define SVI (   a,
  b,
  c,
  d,
  e,
  f,
  g,
 
)    { a, b, f, c, d, e, g, h, VE_DEFAULT, 0, 0 }

Writes the properties of a ship into the ShipVehicleInfo struct.

See also
ShipVehicleInfo
Parameters
aimage_index
bcost_factor
cacceleration (1 unit = 1/3.2 mph per tick = 0.5 km-ish/h per tick)
dmax_speed (1 unit = 1/3.2 mph = 0.5 km-ish/h)
ecapacity (persons, bags, tons, pieces, items, cubic metres, ...)
frunning_cost
gsound effect
hrefittable

Definition at line 567 of file engines.h.

◆ T

#define T   1

Definition at line 96 of file engines.h.

◆ V

#define V   EC_MAGLEV

Definition at line 397 of file engines.h.

◆ W

#define W   RAILVEH_WAGON

Definition at line 391 of file engines.h.

◆ Y

#define Y   8

Definition at line 99 of file engines.h.

Variable Documentation

◆ _orig_aircraft_vehicle_info

constexpr AircraftVehicleInfo _orig_aircraft_vehicle_info[]
staticconstexpr

Definition at line 604 of file engines.h.

◆ _orig_engine_info

constexpr EngineInfo _orig_engine_info[]
staticconstexpr

Definition at line 100 of file engines.h.

◆ _orig_rail_vehicle_info

constexpr RailVehicleInfo _orig_rail_vehicle_info[]
staticconstexpr

Definition at line 411 of file engines.h.

◆ _orig_road_vehicle_info

constexpr RoadVehicleInfo _orig_road_vehicle_info[]
staticconstexpr

Definition at line 672 of file engines.h.

◆ _orig_ship_vehicle_info

constexpr ShipVehicleInfo _orig_ship_vehicle_info[]
staticconstexpr
Initial value:
= {
SVI( 1, 160, 1, 48, 220, 140, SND_06_DEPARTURE_CARGO_SHIP, 0 ),
SVI( 1, 176, 1, 80, 350, 125, SND_06_DEPARTURE_CARGO_SHIP, 0 ),
SVI( 2, 96, 1, 64, 100, 90, SND_07_DEPARTURE_FERRY, 0 ),
SVI( 2, 112, 1, 128, 130, 80, SND_07_DEPARTURE_FERRY, 0 ),
SVI( 3, 148, 1, 224, 100, 190, SND_07_DEPARTURE_FERRY, 0 ),
SVI( 2, 96, 1, 64, 100, 90, SND_07_DEPARTURE_FERRY, 0 ),
SVI( 2, 112, 1, 128, 130, 80, SND_07_DEPARTURE_FERRY, 0 ),
SVI( 0, 128, 1, 48, 160, 150, SND_06_DEPARTURE_CARGO_SHIP, 1 ),
SVI( 0, 144, 1, 80, 190, 113, SND_06_DEPARTURE_CARGO_SHIP, 1 ),
SVI( 0, 128, 1, 48, 160, 150, SND_06_DEPARTURE_CARGO_SHIP, 1 ),
SVI( 0, 144, 1, 80, 190, 113, SND_06_DEPARTURE_CARGO_SHIP, 1 ),
}
#define SVI(a, b, c, d, e, f, g, h)
Writes the properties of a ship into the ShipVehicleInfo struct.
Definition engines.h:567
@ SND_07_DEPARTURE_FERRY
5 == 0x05 Station departure: passenger ships
Definition sound_type.h:52
@ SND_06_DEPARTURE_CARGO_SHIP
4 == 0x04 Station departure: cargo ships
Definition sound_type.h:51

Definition at line 568 of file engines.h.