OpenTTD Source: src/vehicle_type.h File Reference

OpenTTD Source 15.0-RC2

Data Structures | Typedefs | Enumerations | Variables
vehicle_type.h File Reference

Types related to vehicles. More...

`#include "core/enum_type.hpp"`
`#include "core/pool_type.hpp"`

Go to the source code of this file.

## Data Structures
struct | BaseVehicle
| Base vehicle class. More...

## Typedefs
using | VehicleID = PoolID< uint32_t, struct VehicleIDTag, 0xFF000, 0xFFFFF >
| The type all our vehicle IDs have.
using | DepotCommandFlags = EnumBitSet< DepotCommandFlag, uint8_t >
using | VehicleRandomTriggers = EnumBitSet< VehicleRandomTrigger, uint8_t >

## Enumerations
enum | VehicleType : uint8_t { VEH_BEGIN , VEH_TRAIN = VEH_BEGIN , VEH_ROAD , VEH_SHIP , VEH_AIRCRAFT , VEH_COMPANY_END , VEH_EFFECT = VEH_COMPANY_END , VEH_DISASTER , VEH_END , VEH_INVALID = 0xFF }
| Available vehicle types. More...
enum class | DepotCommandFlag : uint8_t { Service , MassSend , DontCancel }
| Flags for goto depot commands. More...
enum | AccelerationModel : uint8_t { AM_ORIGINAL , AM_REALISTIC }
| Vehicle acceleration models. More...
enum | EngineImageType : uint8_t { EIT_ON_MAP = 0x00 , EIT_IN_DEPOT = 0x10 , EIT_IN_DETAILS = 0x11 , EIT_IN_LIST = 0x12 , EIT_PURCHASE = 0x20 , EIT_PREVIEW = 0x21 }
| Visualisation contexts of vehicles and engines. More...
enum class | VehicleRandomTrigger : uint8_t { NewCargo , Depot , Empty , AnyNewCargo , Callback32 }
| Randomisation triggers for vehicles. More...

## Variables
static const int | GROUND_ACCELERATION = 9800
| Acceleration due to gravity, 9.8 m/s^2.
static const uint | MAX_LENGTH_VEHICLE_NAME_CHARS = 32
| The maximum length of a vehicle name in characters including '\0'.
static const uint | VEHICLE_LENGTH = 8
| The length of a vehicle in tile units.

## Detailed Description

Types related to vehicles.

Definition in file vehicle_type.h.

## Typedef Documentation

## ◆ DepotCommandFlags

using DepotCommandFlags = EnumBitSet<DepotCommandFlag, uint8_t>

Definition at line 60 of file vehicle_type.h.

## ◆ VehicleID

using VehicleID = PoolID<uint32_t, struct VehicleIDTag, 0xFF000, 0xFFFFF>

The type all our vehicle IDs have.

Definition at line 17 of file vehicle_type.h.

## ◆ VehicleRandomTriggers

using VehicleRandomTriggers = EnumBitSet<VehicleRandomTrigger, uint8_t>

Definition at line 91 of file vehicle_type.h.

## Enumeration Type Documentation

## ◆ AccelerationModel

enum AccelerationModel : uint8_t

Vehicle acceleration models.

Definition at line 68 of file vehicle_type.h.

## ◆ DepotCommandFlag

enum class DepotCommandFlag : uint8_t
| strong

Flags for goto depot commands.

Enumerator
Service | The vehicle will leave the depot right after arrival (service only)
MassSend | Tells that it's a mass send to depot command (type in VLW flag)
DontCancel | Don't cancel current goto depot command if any.

Definition at line 55 of file vehicle_type.h.

## ◆ EngineImageType

enum EngineImageType : uint8_t

Visualisation contexts of vehicles and engines.

Enumerator
EIT_ON_MAP | Vehicle drawn in viewport.
EIT_IN_DEPOT | Vehicle drawn in depot.
EIT_IN_DETAILS | Vehicle drawn in vehicle details, refit window, ...
EIT_IN_LIST | Vehicle drawn in vehicle list, group list, ...
EIT_PURCHASE | Vehicle drawn in purchase list, autoreplace gui, ...
EIT_PREVIEW | Vehicle drawn in preview window, news, ...

Definition at line 74 of file vehicle_type.h.

## ◆ VehicleRandomTrigger

enum class VehicleRandomTrigger : uint8_t
| strong

Randomisation triggers for vehicles.

Enumerator
NewCargo | Affected vehicle only: Vehicle is loaded with cargo, after it was empty.
Depot | Front vehicle only: Consist arrived in depot.
Empty | Front vehicle only: Entire consist is empty.
AnyNewCargo | All vehicles in consist: Any vehicle in the consist received new cargo.
Callback32 | All vehicles in consist: 32 day callback requested rerandomisation.

Definition at line 84 of file vehicle_type.h.

## ◆ VehicleType

enum VehicleType : uint8_t

Available vehicle types.

It needs to be 8bits, because we save and load it as such

Enumerator
VEH_TRAIN | Train vehicle type.
VEH_ROAD | Road vehicle type.
VEH_SHIP | Ship vehicle type.
VEH_AIRCRAFT | Aircraft vehicle type.
VEH_COMPANY_END | Last company-ownable type.
VEH_EFFECT | Effect vehicle type (smoke, explosions, sparks, bubbles)
VEH_DISASTER | Disaster vehicle type.
VEH_INVALID | Non-existing type of vehicle.

Definition at line 22 of file vehicle_type.h.

## Variable Documentation

## ◆ GROUND_ACCELERATION

const int GROUND_ACCELERATION = 9800
| static

Acceleration due to gravity, 9.8 m/s^2.

Definition at line 19 of file vehicle_type.h.

Referenced by Engine::GetDisplayMaxTractiveEffort(), and GroundVehicle< T, Type >::PowerChanged().

## ◆ MAX_LENGTH_VEHICLE_NAME_CHARS

const uint MAX_LENGTH_VEHICLE_NAME_CHARS = 32
| static

The maximum length of a vehicle name in characters including '\0'.

Definition at line 62 of file vehicle_type.h.

Referenced by CmdRenameVehicle(), and VehicleViewWindow::OnClick().

## ◆ VEHICLE_LENGTH

const uint VEHICLE_LENGTH = 8
| static

The length of a vehicle in tile units.

Definition at line 65 of file vehicle_type.h.

Referenced by AddArticulatedParts(), CmdBuildRoadVehicle(), Train::ConsistChanged(), FixupTrainLengths(), Train::GetCurveSpeedLimit(), RoadVehicle::GetDisplayImageWidth(), Train::GetDisplayImageWidth(), GetRoadVehLength(), Vehicle::ShowVisualEffect(), SpawnAdvancedVisualEffect(), RoadVehicle::UpdateDeltaXY(), and Train::UpdateDeltaXY().