OpenTTD Source 20260421-master-gc2fbc6fdeb
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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#ifndef ROAD_TYPE_H
11#define ROAD_TYPE_H
12
13#include "core/enum_type.hpp"
14
15typedef uint32_t RoadTypeLabel;
16
17static const RoadTypeLabel ROADTYPE_LABEL_ROAD = 'ROAD';
18static const RoadTypeLabel ROADTYPE_LABEL_TRAM = 'ELRL';
19
31
32using RoadTypes = EnumBitSet<RoadType, uint64_t>;
33
37enum class RoadTramType : uint8_t {
41 Invalid = 0xFF,
42};
43
46
49
56enum class RoadBit : uint8_t {
57 NW = 0,
58 SW = 1,
59 SE = 2,
60 NE = 3,
61};
62
65
68
73
75
82
85
86#endif /* ROAD_TYPE_H */
Enum-as-bit-set wrapper.
Type (helpers) for enums.
#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type)
For some enums it is useful to have pre/post increment/decrement operators.
Definition enum_type.hpp:86
EnumBitSet< RoadTramType, uint8_t > RoadTramTypes
Bitset of RoadTramType elements.
Definition road_type.h:45
static constexpr RoadBits ROAD_W
Road at the two western edges.
Definition road_type.h:72
static constexpr RoadBits ROAD_X
Full road along the x-axis (south-west + north-east).
Definition road_type.h:66
DisallowedRoadDirection
Which directions are disallowed ?
Definition road_type.h:77
@ Northbound
All northbound traffic is disallowed.
Definition road_type.h:79
@ Southbound
All southbound traffic is disallowed.
Definition road_type.h:78
EnumBitSet< RoadBit, uint8_t > RoadBits
Bitset of RoadBit elements.
Definition road_type.h:64
static constexpr RoadBits ROAD_E
Road at the two eastern edges.
Definition road_type.h:70
RoadBit
Enumeration for the road parts on a tile.
Definition road_type.h:56
@ SW
South-west part.
Definition road_type.h:58
@ NW
North-west part.
Definition road_type.h:57
@ NE
North-east part.
Definition road_type.h:60
@ SE
South-east part.
Definition road_type.h:59
EnumBitSet< DisallowedRoadDirection, uint8_t > DisallowedRoadDirections
Bitset of DisallowedRoadDirection elements.
Definition road_type.h:84
static constexpr RoadBits ROAD_ALL
Full 4-way crossing.
Definition road_type.h:74
static constexpr RoadBits ROAD_Y
Full road along the y-axis (north-west + south-east).
Definition road_type.h:67
static constexpr RoadTramTypes ROADTRAMTYPES_ALL
All possible RoadTramTypes.
Definition road_type.h:48
static constexpr RoadBits ROAD_N
Road at the two northern edges.
Definition road_type.h:69
RoadType
The different roadtypes we support.
Definition road_type.h:23
@ INVALID_ROADTYPE
flag for invalid roadtype
Definition road_type.h:28
@ ROADTYPE_TRAM
Trams.
Definition road_type.h:26
@ ROADTYPE_ROAD
Basic road type.
Definition road_type.h:25
@ ROADTYPE_END
Used for iterations.
Definition road_type.h:27
@ ROADTYPE_BEGIN
Used for iterations.
Definition road_type.h:24
static constexpr RoadBits ROAD_S
Road at the two southern edges.
Definition road_type.h:71
RoadTramType
The different types of road type.
Definition road_type.h:37
@ Invalid
Invalid marker.
Definition road_type.h:41
@ End
End marker.
Definition road_type.h:40
@ Tram
Tram type.
Definition road_type.h:39
@ Road
Road type.
Definition road_type.h:38
@ Road
Truck or bus stop.