Factor out OnClick dispatching in Window::HandleEditBoxKey
[openttd/fttd.git] / src / road_type.h
blob5251a53923ab30c2ae1c14ee3d98c4e4ae341eea
1 /* $Id$ */
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 */
10 /** @file road_type.h Enums and other types related to roads. */
12 #ifndef ROAD_TYPE_H
13 #define ROAD_TYPE_H
15 #include "core/enum_type.hpp"
17 /**
18 * The different roadtypes we support
20 * @note currently only ROADTYPE_ROAD and ROADTYPE_TRAM are supported.
22 enum RoadType {
23 ROADTYPE_BEGIN = 0, ///< Used for iterations
24 ROADTYPE_ROAD = 0, ///< Basic road type
25 ROADTYPE_TRAM = 1, ///< Trams
26 ROADTYPE_END, ///< Used for iterations
27 INVALID_ROADTYPE = 0xFF, ///< flag for invalid roadtype
29 DECLARE_POSTFIX_INCREMENT(RoadType)
30 template <> struct EnumPropsT<RoadType> : MakeEnumPropsT<RoadType, byte, ROADTYPE_BEGIN, ROADTYPE_END, INVALID_ROADTYPE, 2> {};
32 /**
33 * The different roadtypes we support, but then a bitmask of them
34 * @note currently only roadtypes with ROADTYPE_ROAD and ROADTYPE_TRAM are supported.
36 enum RoadTypes {
37 ROADTYPES_NONE = 0, ///< No roadtypes
38 ROADTYPES_ROAD = 1 << ROADTYPE_ROAD, ///< Road
39 ROADTYPES_TRAM = 1 << ROADTYPE_TRAM, ///< Trams
40 ROADTYPES_ALL = ROADTYPES_ROAD | ROADTYPES_TRAM, ///< Road + trams
41 ROADTYPES_END, ///< Used for iterations?
42 INVALID_ROADTYPES = 0xFF, ///< Invalid roadtypes
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;
49 /**
50 * Enumeration for the road parts on a tile.
52 * This enumeration defines the possible road parts which
53 * can be build on a tile.
55 enum RoadBits {
56 ROAD_NONE = 0U, ///< No road-part is build
57 ROAD_NW = 1U, ///< North-west part
58 ROAD_SW = 2U, ///< South-west part
59 ROAD_SE = 4U, ///< South-east part
60 ROAD_NE = 8U, ///< North-east part
61 ROAD_X = ROAD_SW | ROAD_NE, ///< Full road along the x-axis (south-west + north-east)
62 ROAD_Y = ROAD_NW | ROAD_SE, ///< Full road along the y-axis (north-west + south-east)
64 ROAD_N = ROAD_NE | ROAD_NW, ///< Road at the two northern edges
65 ROAD_E = ROAD_NE | ROAD_SE, ///< Road at the two eastern edges
66 ROAD_S = ROAD_SE | ROAD_SW, ///< Road at the two southern edges
67 ROAD_W = ROAD_NW | ROAD_SW, ///< Road at the two western edges
69 ROAD_ALL = ROAD_X | ROAD_Y, ///< Full 4-way crossing
71 ROAD_END = ROAD_ALL + 1, ///< Out-of-range roadbits, used for iterations
73 DECLARE_ENUM_AS_BIT_SET(RoadBits)
74 template <> struct EnumPropsT<RoadBits> : MakeEnumPropsT<RoadBits, byte, ROAD_NONE, ROAD_END, ROAD_NONE, 4> {};
76 #endif /* ROAD_TYPE_H */