OpenTTD Source: src/engine_type.h File Reference

OpenTTD Source 15.0-RC2

Data Structures | Typedefs | Enumerations | Functions | Variables
engine_type.h File Reference

Types related to engines. More...

`#include "core/pool_type.hpp"`
`#include "economy_type.h"`
`#include "landscape_type.h"`
`#include "newgrf_callbacks.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"`
`#include "newgrf_badge_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
using | EngineID = PoolID< uint16_t, struct EngineIDTag, 64000, 0xFFFF >
| Unique identification number of an engine.
using | ExtraEngineFlags = EnumBitSet< ExtraEngineFlag, uint8_t >
using | EngineMiscFlags = EnumBitSet< EngineMiscFlag, uint8_t >
using | EngineFlags = EnumBitSet< EngineFlag, uint8_t >

## Enumerations
enum | RailVehicleTypes : uint8_t { RAILVEH_SINGLEHEAD , RAILVEH_MULTIHEAD , RAILVEH_WAGON }
| Available types of rail vehicles. More...
enum | EngineClass : uint8_t { EC_STEAM , EC_DIESEL , EC_ELECTRIC , EC_MONORAIL , EC_MAGLEV }
| Type of rail engine. More...
enum class | VehicleAccelerationModel : uint8_t { Normal , Monorail , Maglev }
| Acceleration model of a vehicle. More...
enum | VisualEffect : uint8_t { VE_OFFSET_START = 0 , VE_OFFSET_COUNT = 4 , VE_OFFSET_CENTRE = 8 , VE_TYPE_START = 4 , VE_TYPE_COUNT = 2 , VE_TYPE_DEFAULT = 0 , VE_TYPE_STEAM = 1 , VE_TYPE_DIESEL = 2 , VE_TYPE_ELECTRIC = 3 , VE_DISABLE_EFFECT = 6 , VE_ADVANCED_EFFECT = VE_DISABLE_EFFECT , VE_DISABLE_WAGON_POWER = 7 , VE_DEFAULT = 0xFF }
| Meaning of the various bits of the visual effect. More...
enum | AircraftSubTypeBits : uint8_t { AIR_HELI = 0 , AIR_CTOL = 1 , AIR_FAST = 2 }
| AircraftVehicleInfo subtypes, bitmask type. More...
enum class | ExtraEngineFlag : uint8_t { NoNews = 0 , NoPreview = 1 , JoinPreview = 2 , SyncReliability = 3 }
| Extra engine flags for NewGRF features. More...
enum class | EngineMiscFlag : uint8_t { RailTilts = 0 , RoadIsTram = 0 , Uses2CC = 1 , RailIsMU = 2 , RailFlips = 3 , AutoRefit = 4 , NoDefaultCargoMultiplier = 5 , NoBreakdownSmoke = 6 , SpriteStack = 7 }
| EngineInfo.misc_flags is a bitmask, with the following values. More...
enum class | EngineFlag : uint8_t { Available = 0 , ExclusivePreview = 1 }
| Engine.flags is a bitmask, with the following values. More...
enum class | EngineNameContext : uint8_t { Generic = 0x00 , VehicleDetails = 0x11 , PurchaseList = 0x20 , PreviewNews = 0x21 , AutoreplaceVehicleInUse = 0x22 }
| Contexts an engine name can be shown in. More...

## Functions
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'.

## Detailed Description

Types related to engines.

Definition in file engine_type.h.

## Typedef Documentation

## ◆ EngineFlags

using EngineFlags = EnumBitSet<EngineFlag, uint8_t>

Definition at line 225 of file engine_type.h.

## ◆ EngineID

using EngineID = PoolID<uint16_t, struct EngineIDTag, 64000, 0xFFFF>

Unique identification number of an engine.

Definition at line 26 of file engine_type.h.

## ◆ EngineMiscFlags

using EngineMiscFlags = EnumBitSet<EngineMiscFlag, uint8_t>

Definition at line 192 of file engine_type.h.

## ◆ ExtraEngineFlags

using ExtraEngineFlags = EnumBitSet<ExtraEngineFlag, uint8_t>

Definition at line 173 of file engine_type.h.

## Enumeration Type Documentation

## ◆ AircraftSubTypeBits

enum AircraftSubTypeBits : uint8_t

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 125 of file engine_type.h.

## ◆ EngineClass

enum EngineClass : uint8_t

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 38 of file engine_type.h.

## ◆ EngineFlag

enum class EngineFlag : uint8_t
| strong

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

Enumerator
Available | This vehicle is available to everyone.
ExclusivePreview | This vehicle is in the exclusive preview stage, either being used or being offered to a company.

Definition at line 221 of file engine_type.h.

## ◆ EngineMiscFlag

enum class EngineMiscFlag : uint8_t
| strong

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

Enumerator
RailTilts | Rail vehicle tilts in curves.
RoadIsTram | Road vehicle is a tram/light rail vehicle.
Uses2CC | Vehicle uses two company colours.
RailIsMU | Rail vehicle is a multiple-unit (DMU/EMU)
RailFlips | Rail vehicle has old depot-flip handling.
AutoRefit | Automatic refitting is allowed.
NoDefaultCargoMultiplier | Use the new capacity algorithm. The default cargotype of the vehicle does not affect capacity multipliers. CB 15 is also called in purchase list.
NoBreakdownSmoke | Do not show black smoke during a breakdown.
SpriteStack | Draw vehicle by stacking multiple sprites.

Definition at line 178 of file engine_type.h.

## ◆ EngineNameContext

enum class EngineNameContext : uint8_t
| strong

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 230 of file engine_type.h.

## ◆ ExtraEngineFlag

enum class ExtraEngineFlag : uint8_t
| strong

Extra engine flags for NewGRF features.

This is defined in the specification a 32 bit value, but most bits are not currently used.

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 167 of file engine_type.h.

## ◆ RailVehicleTypes

enum RailVehicleTypes : uint8_t

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 31 of file engine_type.h.

## ◆ VehicleAccelerationModel

enum class VehicleAccelerationModel : uint8_t
| strong

Acceleration model of a vehicle.

Enumerator
Normal | Default acceleration model.
Monorail | Monorail acceleration model.
Maglev | Maglev acceleration model.

Definition at line 47 of file engine_type.h.

## ◆ VisualEffect

enum VisualEffect : uint8_t

Meaning of the various bits of the visual effect.

Enumerator
VE_OFFSET_START | First bit that contains the offset (0 = front, 8 = centre, 15 = rear)
VE_OFFSET_COUNT | Number of bits used for the offset.
VE_OFFSET_CENTRE | Value of offset corresponding to a position above the centre of the vehicle.
VE_TYPE_START | First bit used for the type of effect.
VE_TYPE_COUNT | Number of bits used for the effect type.
VE_TYPE_DEFAULT | Use default from engine class.
VE_TYPE_STEAM | Steam plumes.
VE_TYPE_DIESEL | Diesel fumes.
VE_TYPE_ELECTRIC | Electric sparks.
VE_DISABLE_EFFECT | Flag to disable visual effect.
VE_ADVANCED_EFFECT | Flag for advanced effects.
VE_DISABLE_WAGON_POWER | Flag to disable wagon power.
VE_DEFAULT | Default value to indicate that visual effect should be based on engine class.

Definition at line 54 of file engine_type.h.

## Function Documentation

## ◆ PackEngineNameDParam()

uint64_t PackEngineNameDParam | ( | EngineID | engine_id,
|  | EngineNameContext | context,
|  | uint32_t | extra_data = `0`
| ) |  |
| inline

Combine an engine ID and a name context to an engine name dparam.

Definition at line 239 of file engine_type.h.

Referenced by DrawAircraftDetails(), DrawEngineList(), DrawRoadVehDetails(), DrawShipDetails(), ReplaceVehicleWindow::DrawWidget(), EnginePreviewWindow::DrawWidget(), EngineNameSorter(), BuildVehicleWindow::FilterByText(), NewVehicleAvailable(), BuildVehicleWindow::OnClick(), and TrainDetailsInfoTab().

## Variable Documentation

## ◆ MAX_LENGTH_ENGINE_NAME_CHARS

const uint MAX_LENGTH_ENGINE_NAME_CHARS = 32
| static

The maximum length of an engine name in characters including '\0'.

Definition at line 244 of file engine_type.h.

Referenced by CmdRenameEngine(), and BuildVehicleWindow::OnClick().