OpenTTD Source 20260721-master-g25ec12c62d
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#include "core/label_type.hpp"
15
16using RoadTypeLabel = Label<struct RoadTypeLabelTag>;
17
18static const RoadTypeLabel ROADTYPE_LABEL_ROAD{"ROAD"};
19static const RoadTypeLabel ROADTYPE_LABEL_TRAM{"ELRL"};
20
31
34
38enum class RoadTramType : uint8_t {
42 Invalid = 0xFF,
43};
44
47
50
57enum class RoadBit : uint8_t {
58 NW = 0,
59 SW = 1,
60 SE = 2,
61 NE = 3,
62};
63
66
69
74
76
83
86
87#endif /* ROAD_TYPE_H */
Enum-as-bit-set wrapper.
Type (helpers) for enums.
A type for 4 character labels/tags/ids in files that should be read/shown as is.
EnumBitSet< RoadTramType, uint8_t > RoadTramTypes
Bitset of RoadTramType elements.
Definition road_type.h:46
EnumBitSet< RoadType, uint64_t > RoadTypes
Bitset of RoadType elements.
Definition road_type.h:33
static constexpr RoadBits ROAD_W
Road at the two western edges.
Definition road_type.h:73
static constexpr RoadBits ROAD_X
Full road along the x-axis (south-west + north-east).
Definition road_type.h:67
DisallowedRoadDirection
Which directions are disallowed ?
Definition road_type.h:78
@ Northbound
All northbound traffic is disallowed.
Definition road_type.h:80
@ Southbound
All southbound traffic is disallowed.
Definition road_type.h:79
EnumBitSet< RoadBit, uint8_t > RoadBits
Bitset of RoadBit elements.
Definition road_type.h:65
static constexpr RoadBits ROAD_E
Road at the two eastern edges.
Definition road_type.h:71
RoadBit
Enumeration for the road parts on a tile.
Definition road_type.h:57
@ SW
South-west part.
Definition road_type.h:59
@ NW
North-west part.
Definition road_type.h:58
@ NE
North-east part.
Definition road_type.h:61
@ SE
South-east part.
Definition road_type.h:60
EnumBitSet< DisallowedRoadDirection, uint8_t > DisallowedRoadDirections
Bitset of DisallowedRoadDirection elements.
Definition road_type.h:85
static constexpr RoadBits ROAD_ALL
Full 4-way crossing.
Definition road_type.h:75
static constexpr RoadBits ROAD_Y
Full road along the y-axis (north-west + south-east).
Definition road_type.h:68
static constexpr RoadTramTypes ROADTRAMTYPES_ALL
All possible RoadTramTypes.
Definition road_type.h:49
static constexpr RoadBits ROAD_N
Road at the two northern edges.
Definition road_type.h:70
RoadType
The different roadtypes we support.
Definition road_type.h:24
@ INVALID_ROADTYPE
flag for invalid roadtype
Definition road_type.h:29
@ ROADTYPE_TRAM
Trams.
Definition road_type.h:27
@ ROADTYPE_ROAD
Basic road type.
Definition road_type.h:26
@ ROADTYPE_END
Used for iterations.
Definition road_type.h:28
@ ROADTYPE_BEGIN
Used for iterations.
Definition road_type.h:25
static constexpr RoadBits ROAD_S
Road at the two southern edges.
Definition road_type.h:72
RoadTramType
The different types of road type.
Definition road_type.h:38
@ End
End marker.
Definition road_type.h:41
@ Tram
Tram type.
Definition road_type.h:40
@ Road
Road type.
Definition road_type.h:39
@ Invalid
broken savegame (used internally)
Definition saveload.h:434
A four character label/tag/id.