OpenTTD Source 20250205-master-gfd85ab1e2c
vehicle_type.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef VEHICLE_TYPE_H
11#define VEHICLE_TYPE_H
12
13#include "core/enum_type.hpp"
14
16typedef uint32_t VehicleID;
17
18static const int GROUND_ACCELERATION = 9800;
19
21enum VehicleType : uint8_t {
22 VEH_BEGIN,
23
24 VEH_TRAIN = VEH_BEGIN,
28
30
33
34 VEH_END,
35 VEH_INVALID = 0xFF,
36};
39
40struct Vehicle;
41struct Train;
42struct RoadVehicle;
43struct Ship;
44struct Aircraft;
45struct EffectVehicle;
46struct DisasterVehicle;
47
53
54static const VehicleID INVALID_VEHICLE = 0xFFFFF;
55
57enum class DepotCommandFlag : uint8_t {
58 Service,
59 MassSend,
62};
64
65static const uint MAX_LENGTH_VEHICLE_NAME_CHARS = 32;
66
68static const uint VEHICLE_LENGTH = 8;
69
71enum AccelerationModel : uint8_t {
72 AM_ORIGINAL,
73 AM_REALISTIC,
74};
75
77enum EngineImageType : uint8_t {
78 EIT_ON_MAP = 0x00,
79 EIT_IN_DEPOT = 0x10,
81 EIT_IN_LIST = 0x12,
82 EIT_PURCHASE = 0x20,
83 EIT_PREVIEW = 0x21,
84};
85
86#endif /* VEHICLE_TYPE_H */
Enum-as-bit-set wrapper.
Type (helpers) for enums.
#define DECLARE_ENUM_AS_ADDABLE(EnumType)
Operator that allows this enumeration to be added to any other enumeration.
Definition enum_type.hpp:78
#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type)
For some enums it is useful to have pre/post increment/decrement operators.
Definition enum_type.hpp:61
Aircraft, helicopters, rotors and their shadows belong to this class.
Definition aircraft.h:72
Base vehicle class.
VehicleType type
Type of vehicle.
Disasters, like submarines, skyrangers and their shadows, belong to this class.
A special vehicle is one of the following:
Buses, trucks and trams belong to this class.
Definition roadveh.h:98
All ships have this type.
Definition ship.h:32
'Train' is either a loco or a wagon.
Definition train.h:89
Vehicle data structure.
EngineImageType
Visualisation contexts of vehicles and engines.
@ EIT_PURCHASE
Vehicle drawn in purchase list, autoreplace gui, ...
@ EIT_IN_DEPOT
Vehicle drawn in depot.
@ EIT_IN_DETAILS
Vehicle drawn in vehicle details, refit window, ...
@ EIT_ON_MAP
Vehicle drawn in viewport.
@ EIT_IN_LIST
Vehicle drawn in vehicle list, group list, ...
@ EIT_PREVIEW
Vehicle drawn in preview window, news, ...
VehicleType
Available vehicle types.
@ VEH_INVALID
Non-existing type of vehicle.
@ VEH_ROAD
Road vehicle type.
@ VEH_DISASTER
Disaster vehicle type.
@ VEH_AIRCRAFT
Aircraft vehicle type.
@ VEH_SHIP
Ship vehicle type.
@ VEH_EFFECT
Effect vehicle type (smoke, explosions, sparks, bubbles)
@ VEH_TRAIN
Train vehicle type.
@ VEH_COMPANY_END
Last company-ownable type.
DepotCommandFlag
Flags for goto depot commands.
@ LocateHangar
Find another airport if the target one lacks a hangar.
@ 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.
@ Service
The vehicle will leave the depot right after arrival (service only)
AccelerationModel
Vehicle acceleration models.
uint32_t VehicleID
The type all our vehicle IDs have.
static const int GROUND_ACCELERATION
Acceleration due to gravity, 9.8 m/s^2.
static const uint MAX_LENGTH_VEHICLE_NAME_CHARS
The maximum length of a vehicle name in characters including '\0'.
static const VehicleID INVALID_VEHICLE
Constant representing a non-existing vehicle.
static const uint VEHICLE_LENGTH
The length of a vehicle in tile units.