OpenTTD Source  1.11.2
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 
16 typedef uint32 VehicleID;
17 
18 static const int GROUND_ACCELERATION = 9800;
19 
21 enum VehicleType : byte {
22  VEH_BEGIN,
23 
24  VEH_TRAIN = VEH_BEGIN,
28 
30 
33 
34  VEH_END,
35  VEH_INVALID = 0xFF,
36 };
39 template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID, 3> {};
40 
41 struct Vehicle;
42 struct Train;
43 struct RoadVehicle;
44 struct Ship;
45 struct Aircraft;
46 struct EffectVehicle;
47 struct DisasterVehicle;
48 
51 {
53 };
54 
55 static const VehicleID INVALID_VEHICLE = 0xFFFFF;
56 
59  // Original PathFinder (OPF) used to be 0
60  VPF_NPF = 1,
61  VPF_YAPF = 2,
62 };
63 
66  DEPOT_SERVICE = (1U << 28),
67  DEPOT_MASS_SEND = (1U << 29),
68  DEPOT_DONT_CANCEL = (1U << 30),
69  DEPOT_LOCATE_HANGAR = (1U << 31),
70  DEPOT_COMMAND_MASK = 0xFU << 28,
71 };
72 
73 static const uint MAX_LENGTH_VEHICLE_NAME_CHARS = 32;
74 
76 static const uint VEHICLE_LENGTH = 8;
77 
80  AM_ORIGINAL,
81  AM_REALISTIC,
82 };
83 
86  EIT_ON_MAP = 0x00,
87  EIT_IN_DEPOT = 0x10,
88  EIT_IN_DETAILS = 0x11,
89  EIT_IN_LIST = 0x12,
90  EIT_PURCHASE = 0x20,
91  EIT_PREVIEW = 0x21,
92 };
93 
94 #endif /* VEHICLE_TYPE_H */
VEH_AIRCRAFT
@ VEH_AIRCRAFT
Aircraft vehicle type.
Definition: vehicle_type.h:27
RoadVehicle
Buses, trucks and trams belong to this class.
Definition: roadveh.h:107
VehiclePathFinders
VehiclePathFinders
Pathfinding option states.
Definition: vehicle_type.h:58
EIT_PREVIEW
@ EIT_PREVIEW
Vehicle drawn in preview window, news, ...
Definition: vehicle_type.h:91
DEPOT_MASS_SEND
@ DEPOT_MASS_SEND
Tells that it's a mass send to depot command (type in VLW flag)
Definition: vehicle_type.h:67
VPF_YAPF
@ VPF_YAPF
Yet Another PathFinder.
Definition: vehicle_type.h:61
EIT_PURCHASE
@ EIT_PURCHASE
Vehicle drawn in purchase list, autoreplace gui, ...
Definition: vehicle_type.h:90
DEPOT_LOCATE_HANGAR
@ DEPOT_LOCATE_HANGAR
Find another airport if the target one lacks a hangar.
Definition: vehicle_type.h:69
EIT_IN_DETAILS
@ EIT_IN_DETAILS
Vehicle drawn in vehicle details, refit window, ...
Definition: vehicle_type.h:88
EngineImageType
EngineImageType
Visualisation contexts of vehicles and engines.
Definition: vehicle_type.h:85
VEH_ROAD
@ VEH_ROAD
Road vehicle type.
Definition: vehicle_type.h:25
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:222
Aircraft
Aircraft, helicopters, rotors and their shadows belong to this class.
Definition: aircraft.h:74
DECLARE_POSTFIX_INCREMENT
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definition: enum_type.hpp:14
EnumPropsT
Informative template class exposing basic enumeration properties used by several other templates belo...
Definition: enum_type.hpp:48
AccelerationModel
AccelerationModel
Vehicle acceleration models.
Definition: vehicle_type.h:79
BaseVehicle
Base vehicle class.
Definition: vehicle_type.h:50
VEH_COMPANY_END
@ VEH_COMPANY_END
Last company-ownable type.
Definition: vehicle_type.h:29
INVALID_VEHICLE
static const VehicleID INVALID_VEHICLE
Constant representing a non-existing vehicle.
Definition: vehicle_type.h:55
EIT_ON_MAP
@ EIT_ON_MAP
Vehicle drawn in viewport.
Definition: vehicle_type.h:86
GROUND_ACCELERATION
static const int GROUND_ACCELERATION
Acceleration due to gravity, 9.8 m/s^2.
Definition: vehicle_type.h:18
VEH_EFFECT
@ VEH_EFFECT
Effect vehicle type (smoke, explosions, sparks, bubbles)
Definition: vehicle_type.h:31
Train
'Train' is either a loco or a wagon.
Definition: train.h:85
VEH_INVALID
@ VEH_INVALID
Non-existing type of vehicle.
Definition: vehicle_type.h:35
DepotCommand
DepotCommand
Flags to add to p1 for goto depot commands.
Definition: vehicle_type.h:65
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
VPF_NPF
@ VPF_NPF
New PathFinder.
Definition: vehicle_type.h:60
DisasterVehicle
Disasters, like submarines, skyrangers and their shadows, belong to this class.
Definition: disaster_vehicle.h:37
EIT_IN_DEPOT
@ EIT_IN_DEPOT
Vehicle drawn in depot.
Definition: vehicle_type.h:87
Ship
All ships have this type.
Definition: ship.h:26
EIT_IN_LIST
@ EIT_IN_LIST
Vehicle drawn in vehicle list, group list, ...
Definition: vehicle_type.h:89
DEPOT_SERVICE
@ DEPOT_SERVICE
The vehicle will leave the depot right after arrival (service only)
Definition: vehicle_type.h:66
VEHICLE_LENGTH
static const uint VEHICLE_LENGTH
The length of a vehicle in tile units.
Definition: vehicle_type.h:76
MAX_LENGTH_VEHICLE_NAME_CHARS
static const uint MAX_LENGTH_VEHICLE_NAME_CHARS
The maximum length of a vehicle name in characters including '\0'.
Definition: vehicle_type.h:73
EffectVehicle
A special vehicle is one of the following:
Definition: effectvehicle_base.h:24
enum_type.hpp
MakeEnumPropsT
Helper template class that makes basic properties of given enumeration type visible from outsize.
Definition: enum_type.hpp:62
VEH_DISASTER
@ VEH_DISASTER
Disaster vehicle type.
Definition: vehicle_type.h:32
VehicleID
uint32 VehicleID
The type all our vehicle IDs have.
Definition: vehicle_type.h:16
VEH_TRAIN
@ VEH_TRAIN
Train vehicle type.
Definition: vehicle_type.h:24
BaseVehicle::type
VehicleType type
Type of vehicle.
Definition: vehicle_type.h:52
VEH_SHIP
@ VEH_SHIP
Ship vehicle type.
Definition: vehicle_type.h:26
DEPOT_DONT_CANCEL
@ DEPOT_DONT_CANCEL
Don't cancel current goto depot command if any.
Definition: vehicle_type.h:68