OpenTTD Source  20241108-master-g80f628063a
engine_type.h File Reference

Types related to engines. More...

#include "economy_type.h"
#include "rail_type.h"
#include "road_type.h"
#include "cargo_type.h"
#include "timer/timer_game_calendar.h"
#include "sound_type.h"
#include "strings_type.h"

Go to the source code of this file.

Data Structures

struct  RailVehicleInfo
 Information about a rail vehicle. More...
 
struct  ShipVehicleInfo
 Information about a ship vehicle. More...
 
struct  AircraftVehicleInfo
 Information about a aircraft vehicle. More...
 
struct  RoadVehicleInfo
 Information about a road vehicle. More...
 
struct  EngineInfo
 Information about a vehicle. More...
 

Typedefs

typedef uint16_t EngineID
 Unique identification number of an engine.
 

Enumerations

enum  RailVehicleTypes { RAILVEH_SINGLEHEAD , RAILVEH_MULTIHEAD , RAILVEH_WAGON }
 Available types of rail vehicles. More...
 
enum  EngineClass {
  EC_STEAM , EC_DIESEL , EC_ELECTRIC , EC_MONORAIL ,
  EC_MAGLEV
}
 Type of rail engine. More...
 
enum  AircraftSubTypeBits { AIR_HELI = 0 , AIR_CTOL = 1 , AIR_FAST = 2 }
 AircraftVehicleInfo subtypes, bitmask type. More...
 
enum class  ExtraEngineFlags : uint32_t {
  None = 0 , NoNews = (1U << 0) , NoPreview = (1U << 1) , JoinPreview = (1U << 2) ,
  SyncReliability = (1U << 3)
}
 
enum  EngineMiscFlags {
  EF_RAIL_TILTS = 0 , EF_ROAD_TRAM = 0 , EF_USES_2CC = 1 , EF_RAIL_IS_MU = 2 ,
  EF_RAIL_FLIPS = 3 , EF_AUTO_REFIT = 4 , EF_NO_DEFAULT_CARGO_MULTIPLIER = 5 , EF_NO_BREAKDOWN_SMOKE = 6 ,
  EF_SPRITE_STACK = 7
}
 EngineInfo.misc_flags is a bitmask, with the following values. More...
 
enum  EngineFlags { ENGINE_AVAILABLE = 1 , ENGINE_EXCLUSIVE_PREVIEW = 2 }
 Engine.flags is a bitmask, with the following values. More...
 
enum  EngineNameContext : uint8_t {
  Generic = 0x00 , VehicleDetails = 0x11 , PurchaseList = 0x20 , PreviewNews = 0x21 ,
  AutoreplaceVehicleInUse = 0x22
}
 Contexts an engine name can be shown in. More...
 

Functions

 DECLARE_ENUM_AS_BIT_SET (ExtraEngineFlags)
 
uint64_t PackEngineNameDParam (EngineID engine_id, EngineNameContext context, uint32_t extra_data=0)
 Combine an engine ID and a name context to an engine name dparam.
 

Variables

static const uint MAX_LENGTH_ENGINE_NAME_CHARS = 32
 The maximum length of an engine name in characters including '\0'.
 
static const EngineID INVALID_ENGINE = 0xFFFF
 Constant denoting an invalid engine.
 

Detailed Description

Types related to engines.

Definition in file engine_type.h.

Enumeration Type Documentation

◆ AircraftSubTypeBits

AircraftVehicleInfo subtypes, bitmask type.

If bit 0 is 0 then it is a helicopter, otherwise it is a plane in which case bit 1 tells us whether it's a big(fast) plane or not.

Enumerator
AIR_CTOL 

Conventional Take Off and Landing, i.e. planes.

Definition at line 93 of file engine_type.h.

◆ EngineClass

Type of rail engine.

Enumerator
EC_STEAM 

Steam rail engine.

EC_DIESEL 

Diesel rail engine.

EC_ELECTRIC 

Electric rail engine.

EC_MONORAIL 

Mono rail engine.

EC_MAGLEV 

Maglev engine.

Definition at line 33 of file engine_type.h.

◆ EngineFlags

Engine.flags is a bitmask, with the following values.

Enumerator
ENGINE_AVAILABLE 

This vehicle is available to everyone.

ENGINE_EXCLUSIVE_PREVIEW 

This vehicle is in the exclusive preview stage, either being used or being offered to a company.

Definition at line 182 of file engine_type.h.

◆ EngineMiscFlags

EngineInfo.misc_flags is a bitmask, with the following values.

Enumerator
EF_RAIL_TILTS 

Rail vehicle tilts in curves.

EF_ROAD_TRAM 

Road vehicle is a tram/light rail vehicle.

EF_USES_2CC 

Vehicle uses two company colours.

EF_RAIL_IS_MU 

Rail vehicle is a multiple-unit (DMU/EMU)

EF_RAIL_FLIPS 

Rail vehicle has old depot-flip handling.

EF_AUTO_REFIT 

Automatic refitting is allowed.

EF_NO_DEFAULT_CARGO_MULTIPLIER 

Use the new capacity algorithm. The default cargotype of the vehicle does not affect capacity multipliers. CB 15 is also called in purchase list.

EF_NO_BREAKDOWN_SMOKE 

Do not show black smoke during a breakdown.

EF_SPRITE_STACK 

Draw vehicle by stacking multiple sprites.

Definition at line 167 of file engine_type.h.

◆ EngineNameContext

enum EngineNameContext : uint8_t

Contexts an engine name can be shown in.

Enumerator
Generic 

No specific context available.

VehicleDetails 

Name is shown in the vehicle details GUI.

PurchaseList 

Name is shown in the purchase list (including autoreplace window 'Available vehicles' panel).

PreviewNews 

Name is shown in exclusive preview or newspaper.

AutoreplaceVehicleInUse 

Name is show in the autoreplace window 'Vehicles in use' panel.

Definition at line 190 of file engine_type.h.

◆ ExtraEngineFlags

enum ExtraEngineFlags : uint32_t
strong
Enumerator
NoNews 

No 'new vehicle' news will be generated.

NoPreview 

No exclusive preview will be offered.

JoinPreview 

Engine will join exclusive preview with variant parent.

SyncReliability 

Engine reliability will be synced with variant parent.

Definition at line 131 of file engine_type.h.

◆ RailVehicleTypes

Available types of rail vehicles.

Enumerator
RAILVEH_SINGLEHEAD 

indicates a "standalone" locomotive

RAILVEH_MULTIHEAD 

indicates a combination of two locomotives

RAILVEH_WAGON 

simple wagon, not motorized

Definition at line 26 of file engine_type.h.