OpenTTD Source: src/rail_type.h Source File

OpenTTD Source 13.2.1

rail_type.h
Go to the documentation of this file.
1 /*
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/>.
6 */
7
10 #ifndef RAIL_TYPE_H
11 #define RAIL_TYPE_H
12
13 #include "core/enum_type.hpp"
14
15 typedef uint32 RailTypeLabel;
16
17 static const RailTypeLabel RAILTYPE_RAIL_LABEL = 'RAIL';
18 static const RailTypeLabel RAILTYPE_ELECTRIC_LABEL = 'ELRL';
19 static const RailTypeLabel RAILTYPE_MONO_LABEL = 'MONO';
20 static const RailTypeLabel RAILTYPE_MAGLEV_LABEL = 'MGLV';
21
27 enum RailType : byte {
28 RAILTYPE_BEGIN = 0,
29 RAILTYPE_RAIL = 0,
30 RAILTYPE_ELECTRIC = 1,
31 RAILTYPE_MONO = 2,
32 RAILTYPE_MAGLEV = 3,
33 RAILTYPE_END = 64,
34 INVALID_RAILTYPE = 0xFF,
35 };
36
38 DECLARE_POSTFIX_INCREMENT(RailType)
40 template <> struct EnumPropsT<RailType> : MakeEnumPropsT<RailType, byte, RAILTYPE_BEGIN, RAILTYPE_END, INVALID_RAILTYPE, 6> {};
41
46 enum RailTypes : uint64 {
47 RAILTYPES_NONE = 0,
48 RAILTYPES_RAIL = 1 << RAILTYPE_RAIL,
49 RAILTYPES_ELECTRIC = 1 << RAILTYPE_ELECTRIC,
50 RAILTYPES_MONO = 1 << RAILTYPE_MONO,
51 RAILTYPES_MAGLEV = 1 << RAILTYPE_MAGLEV,
52 INVALID_RAILTYPES = UINT64_MAX,
53 };
54 DECLARE_ENUM_AS_BIT_SET(RailTypes)
55
56 #endif /* RAIL_TYPE_H */
RAILTYPE_MAGLEV
@ RAILTYPE_MAGLEV
Maglev.
Definition: rail_type.h:32
RAILTYPES_ELECTRIC
@ RAILTYPES_ELECTRIC
Electrified rails.
Definition: rail_type.h:49
RAILTYPE_MONO
@ RAILTYPE_MONO
Monorail.
Definition: rail_type.h:31
RAILTYPES_NONE
@ RAILTYPES_NONE
No rail types.
Definition: rail_type.h:47
INVALID_RAILTYPES
@ INVALID_RAILTYPES
Invalid railtypes.
Definition: rail_type.h:52
RAILTYPE_ELECTRIC
@ RAILTYPE_ELECTRIC
Electric rails.
Definition: rail_type.h:30
DECLARE_POSTFIX_INCREMENT
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definition: enum_type.hpp:14
EnumPropsT
Informative template class exposing basic enumeration properties used by several other templates belo...
Definition: enum_type.hpp:48
RailType
RailType
Enumeration for all possible railtypes.
Definition: rail_type.h:27
RAILTYPES_RAIL
@ RAILTYPES_RAIL
Non-electrified rails.
Definition: rail_type.h:48
RAILTYPE_RAIL
@ RAILTYPE_RAIL
Standard non-electric rails.
Definition: rail_type.h:29
RAILTYPES_MONO
@ RAILTYPES_MONO
Monorail!
Definition: rail_type.h:50
RAILTYPE_END
@ RAILTYPE_END
Used for iterations.
Definition: rail_type.h:33
enum_type.hpp
MakeEnumPropsT
Helper template class that makes basic properties of given enumeration type visible from outsize.
Definition: enum_type.hpp:62
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
RailTypes
RailTypes
The different railtypes we support, but then a bitmask of them.
Definition: rail_type.h:46
RAILTYPES_MAGLEV
@ RAILTYPES_MAGLEV
Ever fast maglev.
Definition: rail_type.h:51
INVALID_RAILTYPE
@ INVALID_RAILTYPE
Flag for invalid railtype.
Definition: rail_type.h:34
RAILTYPE_BEGIN
@ RAILTYPE_BEGIN
Used for iterations.
Definition: rail_type.h:28