Fix: Don't allow right-click to close world generation progress window. (#13084)
[openttd-github.git] / src / road_type.h
blob96be7b858ec3f839624e27ce588802376d551b27
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 road_type.h Enums and other types related to roads. */
10 #ifndef ROAD_TYPE_H
11 #define ROAD_TYPE_H
13 #include "core/enum_type.hpp"
15 typedef uint32_t RoadTypeLabel;
17 static const RoadTypeLabel ROADTYPE_LABEL_ROAD = 'ROAD';
18 static const RoadTypeLabel ROADTYPE_LABEL_TRAM = 'ELRL';
20 /**
21 * The different roadtypes we support
23 * @note currently only ROADTYPE_ROAD and ROADTYPE_TRAM are supported.
25 enum RoadType : uint8_t {
26 ROADTYPE_BEGIN = 0, ///< Used for iterations
27 ROADTYPE_ROAD = 0, ///< Basic road type
28 ROADTYPE_TRAM = 1, ///< Trams
29 ROADTYPE_END = 63, ///< Used for iterations
30 INVALID_ROADTYPE = 63, ///< flag for invalid roadtype
32 DECLARE_POSTFIX_INCREMENT(RoadType)
34 /**
35 * The different roadtypes we support, but then a bitmask of them.
36 * @note Must be treated as a uint64_t type, narrowing it causes bit membership tests to give wrong results.
38 enum RoadTypes : uint64_t {
39 ROADTYPES_NONE = 0, ///< No roadtypes
40 ROADTYPES_ROAD = 1 << ROADTYPE_ROAD, ///< Road
41 ROADTYPES_TRAM = 1 << ROADTYPE_TRAM, ///< Trams
42 INVALID_ROADTYPES = UINT64_MAX, ///< Invalid roadtypes
44 DECLARE_ENUM_AS_BIT_SET(RoadTypes)
46 /**
47 * Enumeration for the road parts on a tile.
49 * This enumeration defines the possible road parts which
50 * can be build on a tile.
52 enum RoadBits : uint8_t {
53 ROAD_NONE = 0U, ///< No road-part is build
54 ROAD_NW = 1U, ///< North-west part
55 ROAD_SW = 2U, ///< South-west part
56 ROAD_SE = 4U, ///< South-east part
57 ROAD_NE = 8U, ///< North-east part
58 ROAD_X = ROAD_SW | ROAD_NE, ///< Full road along the x-axis (south-west + north-east)
59 ROAD_Y = ROAD_NW | ROAD_SE, ///< Full road along the y-axis (north-west + south-east)
61 ROAD_N = ROAD_NE | ROAD_NW, ///< Road at the two northern edges
62 ROAD_E = ROAD_NE | ROAD_SE, ///< Road at the two eastern edges
63 ROAD_S = ROAD_SE | ROAD_SW, ///< Road at the two southern edges
64 ROAD_W = ROAD_NW | ROAD_SW, ///< Road at the two western edges
66 ROAD_ALL = ROAD_X | ROAD_Y, ///< Full 4-way crossing
68 ROAD_END = ROAD_ALL + 1, ///< Out-of-range roadbits, used for iterations
70 DECLARE_ENUM_AS_BIT_SET(RoadBits)
72 /** Which directions are disallowed ? */
73 enum DisallowedRoadDirections : uint8_t {
74 DRD_NONE, ///< None of the directions are disallowed
75 DRD_SOUTHBOUND, ///< All southbound traffic is disallowed
76 DRD_NORTHBOUND, ///< All northbound traffic is disallowed
77 DRD_BOTH, ///< All directions are disallowed
78 DRD_END, ///< Sentinel
80 DECLARE_ENUM_AS_BIT_SET(DisallowedRoadDirections)
82 #endif /* ROAD_TYPE_H */