OpenTTD

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

- File List
- Globals

rail_type.h
Go to the documentation of this file.
1 /* $Id: rail_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 RAIL_TYPE_H
13 #define RAIL_TYPE_H
14
15 #include "core/enum_type.hpp"
16
17 typedef uint32 RailTypeLabel;
18
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';
23
29 enum RailType {
30 RAILTYPE_BEGIN = 0,
31 RAILTYPE_RAIL = 0,
32 RAILTYPE_ELECTRIC = 1,
33 RAILTYPE_MONO = 2,
34 RAILTYPE_MAGLEV = 3,
35 RAILTYPE_END = 16,
36 INVALID_RAILTYPE = 0xFF,
37
38 DEF_RAILTYPE_FIRST = RAILTYPE_END,
39 DEF_RAILTYPE_LAST,
40 DEF_RAILTYPE_MOST_USED,
41 };
42
44 DECLARE_POSTFIX_INCREMENT(RailType)
46 template <> struct EnumPropsT<RailType> : MakeEnumPropsT<RailType, byte, RAILTYPE_BEGIN, RAILTYPE_END, INVALID_RAILTYPE, 4> {};
47 typedef TinyEnumT<RailType> RailTypeByte;
48
52 enum RailTypes {
53 RAILTYPES_NONE = 0,
54 RAILTYPES_RAIL = 1 << RAILTYPE_RAIL,
55 RAILTYPES_ELECTRIC = 1 << RAILTYPE_ELECTRIC,
56 RAILTYPES_MONO = 1 << RAILTYPE_MONO,
57 RAILTYPES_MAGLEV = 1 << RAILTYPE_MAGLEV,
58 INVALID_RAILTYPES = UINT_MAX,
59 };
60 DECLARE_ENUM_AS_BIT_SET(RailTypes)
61
62 #endif /* RAIL_TYPE_H */