OpenTTD Source: src/road_type.h Source File

OpenTTD Source 14.0-beta1

road_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 ROAD_TYPE_H
11 #define ROAD_TYPE_H
12
13 #include "core/enum_type.hpp"
14
15 typedef uint32_t RoadTypeLabel;
16
17 static const RoadTypeLabel ROADTYPE_LABEL_ROAD = 'ROAD';
18 static const RoadTypeLabel ROADTYPE_LABEL_TRAM = 'ELRL';
19
25 enum RoadType : byte {
26 ROADTYPE_BEGIN = 0,
27 ROADTYPE_ROAD = 0,
28 ROADTYPE_TRAM = 1,
29 ROADTYPE_END = 63,
30 INVALID_ROADTYPE = 63,
31 };
32 DECLARE_POSTFIX_INCREMENT(RoadType)
33
34
38 enum RoadTypes : uint64_t {
39 ROADTYPES_NONE = 0,
40 ROADTYPES_ROAD = 1 << ROADTYPE_ROAD,
41 ROADTYPES_TRAM = 1 << ROADTYPE_TRAM,
42 INVALID_ROADTYPES = UINT64_MAX,
43 };
44 DECLARE_ENUM_AS_BIT_SET(RoadTypes)
45
46
52 enum RoadBits : byte {
53 ROAD_NONE = 0U,
54 ROAD_NW = 1U,
55 ROAD_SW = 2U,
56 ROAD_SE = 4U,
57 ROAD_NE = 8U,
58 ROAD_X = ROAD_SW | ROAD_NE,
59 ROAD_Y = ROAD_NW | ROAD_SE,
60
61 ROAD_N = ROAD_NE | ROAD_NW,
62 ROAD_E = ROAD_NE | ROAD_SE,
63 ROAD_S = ROAD_SE | ROAD_SW,
64 ROAD_W = ROAD_NW | ROAD_SW,
65
66 ROAD_ALL = ROAD_X | ROAD_Y,
67
68 ROAD_END = ROAD_ALL + 1,
69 };
70 DECLARE_ENUM_AS_BIT_SET(RoadBits)
71
72
73 enum DisallowedRoadDirections : byte {
74 DRD_NONE,
75 DRD_SOUTHBOUND,
76 DRD_NORTHBOUND,
77 DRD_BOTH,
78 DRD_END,
79 };
80 DECLARE_ENUM_AS_BIT_SET(DisallowedRoadDirections)
81
82 #endif /* ROAD_TYPE_H */
ROADTYPE_END
@ ROADTYPE_END
Used for iterations.
Definition: road_type.h:29
ROAD_S
@ ROAD_S
Road at the two southern edges.
Definition: road_type.h:63
ROADTYPES_ROAD
@ ROADTYPES_ROAD
Road.
Definition: road_type.h:40
INVALID_ROADTYPE
@ INVALID_ROADTYPE
flag for invalid roadtype
Definition: road_type.h:30
ROAD_W
@ ROAD_W
Road at the two western edges.
Definition: road_type.h:64
ROAD_X
@ ROAD_X
Full road along the x-axis (south-west + north-east)
Definition: road_type.h:58
DECLARE_POSTFIX_INCREMENT
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definition: enum_type.hpp:14
ROAD_Y
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
Definition: road_type.h:59
ROADTYPES_NONE
@ ROADTYPES_NONE
No roadtypes.
Definition: road_type.h:39
ROAD_ALL
@ ROAD_ALL
Full 4-way crossing.
Definition: road_type.h:66
ROAD_NE
@ ROAD_NE
North-east part.
Definition: road_type.h:57
ROAD_END
@ ROAD_END
Out-of-range roadbits, used for iterations.
Definition: road_type.h:68
RoadTypes
RoadTypes
The different roadtypes we support, but then a bitmask of them.
Definition: road_type.h:38
DisallowedRoadDirections
DisallowedRoadDirections
Which directions are disallowed ?
Definition: road_type.h:73
INVALID_ROADTYPES
@ INVALID_ROADTYPES
Invalid roadtypes.
Definition: road_type.h:42
ROADTYPE_ROAD
@ ROADTYPE_ROAD
Basic road type.
Definition: road_type.h:27
DRD_NONE
@ DRD_NONE
None of the directions are disallowed.
Definition: road_type.h:74
DRD_SOUTHBOUND
@ DRD_SOUTHBOUND
All southbound traffic is disallowed.
Definition: road_type.h:75
DRD_BOTH
@ DRD_BOTH
All directions are disallowed.
Definition: road_type.h:77
ROAD_N
@ ROAD_N
Road at the two northern edges.
Definition: road_type.h:61
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:25
RoadBits
RoadBits
Enumeration for the road parts on a tile.
Definition: road_type.h:52
enum_type.hpp
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
ROAD_NW
@ ROAD_NW
North-west part.
Definition: road_type.h:54
ROAD_SW
@ ROAD_SW
South-west part.
Definition: road_type.h:55
ROAD_NONE
@ ROAD_NONE
No road-part is build.
Definition: road_type.h:53
ROAD_SE
@ ROAD_SE
South-east part.
Definition: road_type.h:56
ROADTYPE_TRAM
@ ROADTYPE_TRAM
Trams.
Definition: road_type.h:28
ROADTYPES_TRAM
@ ROADTYPES_TRAM
Trams.
Definition: road_type.h:41
ROAD_E
@ ROAD_E
Road at the two eastern edges.
Definition: road_type.h:62
ROADTYPE_BEGIN
@ ROADTYPE_BEGIN
Used for iterations.
Definition: road_type.h:26
DRD_END
@ DRD_END
Sentinel.
Definition: road_type.h:78
DRD_NORTHBOUND
@ DRD_NORTHBOUND
All northbound traffic is disallowed.
Definition: road_type.h:76