(svn r27985) -Codechange: Convert VA2 switches into ones with non-overlapping ranges...
[openttd.git] / src / vehicle_type.h
blob0921b39e36f625edeb41b157bbd9f454b8a67b4f
1 /* $Id$ */
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 */
10 /** @file vehicle_type.h Types related to vehicles. */
12 #ifndef VEHICLE_TYPE_H
13 #define VEHICLE_TYPE_H
15 #include "core/enum_type.hpp"
17 /** The type all our vehicle IDs have. */
18 typedef uint32 VehicleID;
20 /** Available vehicle types. */
21 enum VehicleType {
22 VEH_BEGIN,
24 VEH_TRAIN = VEH_BEGIN, ///< %Train vehicle type.
25 VEH_ROAD, ///< Road vehicle type.
26 VEH_SHIP, ///< %Ship vehicle type.
27 VEH_AIRCRAFT, ///< %Aircraft vehicle type.
29 VEH_COMPANY_END, ///< Last company-ownable type.
31 VEH_EFFECT = VEH_COMPANY_END, ///< Effect vehicle type (smoke, explosions, sparks, bubbles)
32 VEH_DISASTER, ///< Disaster vehicle type.
34 VEH_END,
35 VEH_INVALID = 0xFF, ///< Non-existing type of vehicle.
37 DECLARE_POSTFIX_INCREMENT(VehicleType)
38 /** Helper information for extract tool. */
39 template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID, 3> {};
40 /** It needs to be 8bits, because we save and load it as such */
41 typedef SimpleTinyEnumT<VehicleType, byte> VehicleTypeByte;
43 struct Vehicle;
44 struct Train;
45 struct RoadVehicle;
46 struct Ship;
47 struct Aircraft;
48 struct EffectVehicle;
49 struct DisasterVehicle;
51 /** Base vehicle class. */
52 struct BaseVehicle
54 VehicleTypeByte type; ///< Type of vehicle
57 static const VehicleID INVALID_VEHICLE = 0xFFFFF; ///< Constant representing a non-existing vehicle.
59 /** Pathfinding option states */
60 enum VehiclePathFinders {
61 VPF_OPF = 0, ///< The Original PathFinder (only for ships)
62 VPF_NPF = 1, ///< New PathFinder
63 VPF_YAPF = 2, ///< Yet Another PathFinder
66 /** Flags to add to p1 for goto depot commands. */
67 enum DepotCommand {
68 DEPOT_SERVICE = (1U << 28), ///< The vehicle will leave the depot right after arrival (serivce only)
69 DEPOT_MASS_SEND = (1U << 29), ///< Tells that it's a mass send to depot command (type in VLW flag)
70 DEPOT_DONT_CANCEL = (1U << 30), ///< Don't cancel current goto depot command if any
71 DEPOT_LOCATE_HANGAR = (1U << 31), ///< Find another airport if the target one lacks a hangar
72 DEPOT_COMMAND_MASK = 0xFU << 28,
75 static const uint MAX_LENGTH_VEHICLE_NAME_CHARS = 32; ///< The maximum length of a vehicle name in characters including '\0'
77 /** The length of a vehicle in tile units. */
78 static const uint VEHICLE_LENGTH = 8;
80 /** Vehicle acceleration models. */
81 enum AccelerationModel {
82 AM_ORIGINAL,
83 AM_REALISTIC,
86 /** Visualisation contexts of vehicles and engines. */
87 enum EngineImageType {
88 EIT_ON_MAP = 0x00, ///< Vehicle drawn in viewport.
89 EIT_IN_DEPOT = 0x10, ///< Vehicle drawn in depot.
90 EIT_IN_DETAILS = 0x11, ///< Vehicle drawn in vehicle details, refit window, ...
91 EIT_IN_LIST = 0x12, ///< Vehicle drawn in vehicle list, group list, ...
92 EIT_PURCHASE = 0x20, ///< Vehicle drawn in purchase list, autoreplace gui, ...
93 EIT_PREVIEW = 0x21, ///< Vehicle drawn in preview window, news, ...
96 #endif /* VEHICLE_TYPE_H */