Update readme.md
[openttd-joker.git] / src / rail_type.h
blob98f4dd0b1c419da6eea30ff918ffa6261e58388e
1 /* $Id: rail_type.h 23595 2011-12-19 17:48:04Z rubidium $ */
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 rail_type.h The different types of rail */
12 #ifndef RAIL_TYPE_H
13 #define RAIL_TYPE_H
15 #include "core/enum_type.hpp"
17 typedef uint32 RailTypeLabel;
19 static const RailTypeLabel RAILTYPE_RAIL_LABEL = 'RAIL';
20 static const RailTypeLabel RAILTYPE_ELECTRIC_LABEL = 'ELRL';
21 static const RailTypeLabel RAILTYPE_MONO_LABEL = 'MONO';
22 static const RailTypeLabel RAILTYPE_MAGLEV_LABEL = 'MGLV';
24 /**
25 * Enumeration for all possible railtypes.
27 * This enumeration defines all 4 possible railtypes.
29 enum RailType {
30 RAILTYPE_BEGIN = 0, ///< Used for iterations
31 RAILTYPE_RAIL = 0, ///< Standard non-electric rails
32 RAILTYPE_ELECTRIC = 1, ///< Electric rails
33 RAILTYPE_MONO = 2, ///< Monorail
34 RAILTYPE_MAGLEV = 3, ///< Maglev
35 RAILTYPE_END = 32, ///< Used for iterations
36 INVALID_RAILTYPE = 0xFF, ///< Flag for invalid railtype
38 DEF_RAILTYPE_FIRST = RAILTYPE_END, ///< Default railtype: first available
39 DEF_RAILTYPE_LAST, ///< Default railtype: last available
40 DEF_RAILTYPE_MOST_USED, ///< Default railtype: most used
43 /** Allow incrementing of Track variables */
44 DECLARE_POSTFIX_INCREMENT(RailType)
45 /** Define basic enum properties */
46 template <> struct EnumPropsT<RailType> : MakeEnumPropsT<RailType, byte, RAILTYPE_BEGIN, RAILTYPE_END, INVALID_RAILTYPE, 5> {};
47 typedef TinyEnumT<RailType> RailTypeByte;
49 /**
50 * The different roadtypes we support, but then a bitmask of them
52 enum RailTypes {
53 RAILTYPES_NONE = 0, ///< No rail types
54 RAILTYPES_RAIL = 1 << RAILTYPE_RAIL, ///< Non-electrified rails
55 RAILTYPES_ELECTRIC = 1 << RAILTYPE_ELECTRIC, ///< Electrified rails
56 RAILTYPES_MONO = 1 << RAILTYPE_MONO, ///< Monorail!
57 RAILTYPES_MAGLEV = 1 << RAILTYPE_MAGLEV, ///< Ever fast maglev
58 INVALID_RAILTYPES = UINT_MAX, ///< Invalid railtypes
60 DECLARE_ENUM_AS_BIT_SET(RailTypes)
62 #endif /* RAIL_TYPE_H */