Fix: Don't allow right-click to close world generation progress window. (#13084)
[openttd-github.git] / src / vehicle_type.h
blobbb645f6ef27e6119bf0d6588d82e18c06ba77b12
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 */
8 /** @file vehicle_type.h Types related to vehicles. */
10 #ifndef VEHICLE_TYPE_H
11 #define VEHICLE_TYPE_H
13 #include "core/enum_type.hpp"
15 /** The type all our vehicle IDs have. */
16 typedef uint32_t VehicleID;
18 static const int GROUND_ACCELERATION = 9800; ///< Acceleration due to gravity, 9.8 m/s^2
20 /** Available vehicle types. It needs to be 8bits, because we save and load it as such */
21 enum VehicleType : uint8_t {
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 DECLARE_ENUM_AS_ADDABLE(VehicleType)
40 struct Vehicle;
41 struct Train;
42 struct RoadVehicle;
43 struct Ship;
44 struct Aircraft;
45 struct EffectVehicle;
46 struct DisasterVehicle;
48 /** Base vehicle class. */
49 struct BaseVehicle
51 VehicleType type; ///< Type of vehicle
54 static const VehicleID INVALID_VEHICLE = 0xFFFFF; ///< Constant representing a non-existing vehicle.
56 /** Flags for goto depot commands. */
57 enum class DepotCommand : uint8_t {
58 None = 0, ///< No special flags.
59 Service = (1U << 0), ///< The vehicle will leave the depot right after arrival (service only)
60 MassSend = (1U << 1), ///< Tells that it's a mass send to depot command (type in VLW flag)
61 DontCancel = (1U << 2), ///< Don't cancel current goto depot command if any
62 LocateHangar = (1U << 3), ///< Find another airport if the target one lacks a hangar
64 DECLARE_ENUM_AS_BIT_SET(DepotCommand)
66 static const uint MAX_LENGTH_VEHICLE_NAME_CHARS = 32; ///< The maximum length of a vehicle name in characters including '\0'
68 /** The length of a vehicle in tile units. */
69 static const uint VEHICLE_LENGTH = 8;
71 /** Vehicle acceleration models. */
72 enum AccelerationModel {
73 AM_ORIGINAL,
74 AM_REALISTIC,
77 /** Visualisation contexts of vehicles and engines. */
78 enum EngineImageType {
79 EIT_ON_MAP = 0x00, ///< Vehicle drawn in viewport.
80 EIT_IN_DEPOT = 0x10, ///< Vehicle drawn in depot.
81 EIT_IN_DETAILS = 0x11, ///< Vehicle drawn in vehicle details, refit window, ...
82 EIT_IN_LIST = 0x12, ///< Vehicle drawn in vehicle list, group list, ...
83 EIT_PURCHASE = 0x20, ///< Vehicle drawn in purchase list, autoreplace gui, ...
84 EIT_PREVIEW = 0x21, ///< Vehicle drawn in preview window, news, ...
87 #endif /* VEHICLE_TYPE_H */