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