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/>.
8 /** @file road_type.h Enums and other types related to roads. */
13 #include "core/enum_type.hpp"
15 typedef uint32 RoadTypeLabel
;
18 * The different roadtypes we support
20 * @note currently only ROADTYPE_ROAD and ROADTYPE_TRAM are supported.
23 ROADTYPE_BEGIN
= 0, ///< Used for iterations
24 ROADTYPE_ROAD
= 0, ///< Basic road type
25 ROADTYPE_TRAM
= 1, ///< Trams
26 ROADTYPE_END
= 63, ///< Used for iterations
27 INVALID_ROADTYPE
= 63, ///< flag for invalid roadtype
29 DECLARE_POSTFIX_INCREMENT(RoadType
)
30 template <> struct EnumPropsT
<RoadType
> : MakeEnumPropsT
<RoadType
, byte
, ROADTYPE_BEGIN
, ROADTYPE_END
, INVALID_ROADTYPE
, 6> {};
33 * The different roadtypes we support, but then a bitmask of them.
34 * @note Must be treated as a uint64 type, narrowing it causes bit membership tests to give wrong results.
36 enum RoadTypes
: uint64
{
37 ROADTYPES_NONE
= 0, ///< No roadtypes
38 ROADTYPES_ROAD
= 1 << ROADTYPE_ROAD
, ///< Road
39 ROADTYPES_TRAM
= 1 << ROADTYPE_TRAM
, ///< Trams
40 INVALID_ROADTYPES
= UINT64_MAX
, ///< Invalid roadtypes
42 DECLARE_ENUM_AS_BIT_SET(RoadTypes
)
45 * Enumeration for the road parts on a tile.
47 * This enumeration defines the possible road parts which
48 * can be build on a tile.
51 ROAD_NONE
= 0U, ///< No road-part is build
52 ROAD_NW
= 1U, ///< North-west part
53 ROAD_SW
= 2U, ///< South-west part
54 ROAD_SE
= 4U, ///< South-east part
55 ROAD_NE
= 8U, ///< North-east part
56 ROAD_X
= ROAD_SW
| ROAD_NE
, ///< Full road along the x-axis (south-west + north-east)
57 ROAD_Y
= ROAD_NW
| ROAD_SE
, ///< Full road along the y-axis (north-west + south-east)
59 ROAD_N
= ROAD_NE
| ROAD_NW
, ///< Road at the two northern edges
60 ROAD_E
= ROAD_NE
| ROAD_SE
, ///< Road at the two eastern edges
61 ROAD_S
= ROAD_SE
| ROAD_SW
, ///< Road at the two southern edges
62 ROAD_W
= ROAD_NW
| ROAD_SW
, ///< Road at the two western edges
64 ROAD_ALL
= ROAD_X
| ROAD_Y
, ///< Full 4-way crossing
66 ROAD_END
= ROAD_ALL
+ 1, ///< Out-of-range roadbits, used for iterations
68 DECLARE_ENUM_AS_BIT_SET(RoadBits
)
69 template <> struct EnumPropsT
<RoadBits
> : MakeEnumPropsT
<RoadBits
, byte
, ROAD_NONE
, ROAD_END
, ROAD_NONE
, 4> {};
71 #endif /* ROAD_TYPE_H */