OpenTTD Source: src/rail_type.h Source File

OpenTTD Source 15.0-RC2

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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef RAIL_TYPE_H
11#define RAIL_TYPE_H
12
13#include "core/enum_type.hpp"
14
15typedef uint32_t RailTypeLabel;
16
17static const RailTypeLabel RAILTYPE_LABEL_RAIL = 'RAIL';
18static const RailTypeLabel RAILTYPE_LABEL_ELECTRIC = 'ELRL';
19static const RailTypeLabel RAILTYPE_LABEL_MONO = 'MONO';
20static const RailTypeLabel RAILTYPE_LABEL_MAGLEV = 'MGLV';
21
25 enum RailType : uint8_t {
26 RAILTYPE_BEGIN = 0,
27 RAILTYPE_RAIL = 0,
28 RAILTYPE_ELECTRIC = 1,
29 RAILTYPE_MONO = 2,
30 RAILTYPE_MAGLEV = 3,
31 RAILTYPE_END = 64,
32 INVALID_RAILTYPE = 0xFF,
33};
34
36 DECLARE_INCREMENT_DECREMENT_OPERATORS(RailType)
37
38using RailTypes = EnumBitSet<RailType, uint64_t>;
39
40static constexpr RailTypes INVALID_RAILTYPES{UINT64_MAX};
41
42#endif /* RAIL_TYPE_H */
EnumBitSet< RailType, uint64_t >
enum_type.hpp
Type (helpers) for enums.
DECLARE_INCREMENT_DECREMENT_OPERATORS
#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type)
For some enums it is useful to have pre/post increment/decrement operators.
Definition enum_type.hpp:63
RailType
RailType
Enumeration for all possible railtypes.
Definition rail_type.h:25
RAILTYPE_BEGIN
@ RAILTYPE_BEGIN
Used for iterations.
Definition rail_type.h:26
RAILTYPE_END
@ RAILTYPE_END
Used for iterations.
Definition rail_type.h:31
RAILTYPE_MONO
@ RAILTYPE_MONO
Monorail.
Definition rail_type.h:29
INVALID_RAILTYPE
@ INVALID_RAILTYPE
Flag for invalid railtype.
Definition rail_type.h:32
RAILTYPE_ELECTRIC
@ RAILTYPE_ELECTRIC
Electric rails.
Definition rail_type.h:28
RAILTYPE_RAIL
@ RAILTYPE_RAIL
Standard non-electric rails.
Definition rail_type.h:27
RAILTYPE_MAGLEV
@ RAILTYPE_MAGLEV
Maglev.
Definition rail_type.h:30