OpenTTD: src/road_type.h Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

road_type.h
Go to the documentation of this file.
1 /* $Id: road_type.h 23595 2011-12-19 17:48:04Z rubidium $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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 */
9
12 #ifndef ROAD_TYPE_H
13 #define ROAD_TYPE_H
14
15 #include "core/enum_type.hpp"
16
22 enum RoadType {
23 ROADTYPE_BEGIN = 0,
24 ROADTYPE_ROAD = 0,
25 ROADTYPE_TRAM = 1,
26 ROADTYPE_END,
27 INVALID_ROADTYPE = 0xFF,
28 };
29 DECLARE_POSTFIX_INCREMENT(RoadType)
30 template <> struct EnumPropsT<RoadType> : MakeEnumPropsT<RoadType, byte, ROADTYPE_BEGIN, ROADTYPE_END, INVALID_ROADTYPE, 2> {};
31
36 enum RoadTypes {
37 ROADTYPES_NONE = 0,
38 ROADTYPES_ROAD = 1 << ROADTYPE_ROAD,
39 ROADTYPES_TRAM = 1 << ROADTYPE_TRAM,
40 ROADTYPES_ALL = ROADTYPES_ROAD | ROADTYPES_TRAM,
41 ROADTYPES_END,
42 INVALID_ROADTYPES = 0xFF,
43 };
44 DECLARE_ENUM_AS_BIT_SET(RoadTypes)
45 template <> struct EnumPropsT<RoadTypes> : MakeEnumPropsT<RoadTypes, byte, ROADTYPES_NONE, ROADTYPES_END, INVALID_ROADTYPES, 2> {};
46 typedef SimpleTinyEnumT<RoadTypes, byte> RoadTypesByte;
47
48
55 enum RoadBits {
56 ROAD_NONE = 0U,
57 ROAD_NW = 1U,
58 ROAD_SW = 2U,
59 ROAD_SE = 4U,
60 ROAD_NE = 8U,
61 ROAD_X = ROAD_SW | ROAD_NE,
62 ROAD_Y = ROAD_NW | ROAD_SE,
63
64 ROAD_N = ROAD_NE | ROAD_NW,
65 ROAD_E = ROAD_NE | ROAD_SE,
66 ROAD_S = ROAD_SE | ROAD_SW,
67 ROAD_W = ROAD_NW | ROAD_SW,
68
69 ROAD_ALL = ROAD_X | ROAD_Y,
70
71 ROAD_END = ROAD_ALL + 1,
72 };
73 DECLARE_ENUM_AS_BIT_SET(RoadBits)
74 template <> struct EnumPropsT<RoadBits> : MakeEnumPropsT<RoadBits, byte, ROAD_NONE, ROAD_END, ROAD_NONE, 4> {};
75
76 #endif /* ROAD_TYPE_H */