OpenTTD Source  20241120-master-g6d3adc6169
vehicle_type.h File Reference

Types related to vehicles. More...

#include "core/enum_type.hpp"

Go to the source code of this file.

Data Structures

struct  BaseVehicle
 Base vehicle class. More...
 

Typedefs

typedef uint32_t VehicleID
 The type all our vehicle IDs have.
 

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  DepotCommand : uint8_t {
  None = 0 , Service = (1U << 0) , MassSend = (1U << 1) , DontCancel = (1U << 2) ,
  LocateHangar = (1U << 3)
}
 Flags for goto depot commands. More...
 
enum  AccelerationModel { AM_ORIGINAL , AM_REALISTIC }
 Vehicle acceleration models.
 
enum  EngineImageType {
  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...
 

Variables

static const int GROUND_ACCELERATION = 9800
 Acceleration due to gravity, 9.8 m/s^2.
 
static const VehicleID INVALID_VEHICLE = 0xFFFFF
 Constant representing a non-existing vehicle.
 
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.

Enumeration Type Documentation

◆ DepotCommand

enum DepotCommand : uint8_t
strong

Flags for goto depot commands.

Enumerator
None 

No special flags.

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.

LocateHangar 

Find another airport if the target one lacks a hangar.

Definition at line 57 of file vehicle_type.h.

◆ EngineImageType

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 78 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 21 of file vehicle_type.h.