Files
@ r26832:a6bd9039c80b
Branch filter:
Location: cpp/openttd-patchpack/source/src/road_type.h - annotation
r26832:a6bd9039c80b
3.6 KiB
text/x-c
Codechange: do not declare functions in blocks
r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r8348:e6507808d2e7 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r26114:91e053fa2e46 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r8102:c3f2dd9e9116 r14900:c679fdaeebe6 r23698:1872cc5b7dd7 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r23698:1872cc5b7dd7 r23698:1872cc5b7dd7 r8102:c3f2dd9e9116 r23698:1872cc5b7dd7 r11247:c15ef8b37f5e r11247:c15ef8b37f5e r11247:c15ef8b37f5e r23698:1872cc5b7dd7 r8102:c3f2dd9e9116 r14900:c679fdaeebe6 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r26114:91e053fa2e46 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r8102:c3f2dd9e9116 r12470:62669b41f044 r12470:62669b41f044 r12470:62669b41f044 r12470:62669b41f044 r12470:62669b41f044 r12470:62669b41f044 r15050:7a325f6b804b r15050:7a325f6b804b r18737:1ee35da7fa2f r8102:c3f2dd9e9116 r14900:c679fdaeebe6 r15050:7a325f6b804b r8102:c3f2dd9e9116 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r26114:91e053fa2e46 r8102:c3f2dd9e9116 | /*
* This file is part of OpenTTD.
* 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.
* 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.
* 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/>.
*/
/** @file road_type.h Enums and other types related to roads. */
#ifndef ROAD_TYPE_H
#define ROAD_TYPE_H
#include "core/enum_type.hpp"
typedef uint32 RoadTypeLabel;
/**
* The different roadtypes we support
*
* @note currently only ROADTYPE_ROAD and ROADTYPE_TRAM are supported.
*/
enum RoadType : byte {
ROADTYPE_BEGIN = 0, ///< Used for iterations
ROADTYPE_ROAD = 0, ///< Basic road type
ROADTYPE_TRAM = 1, ///< Trams
ROADTYPE_END = 63, ///< Used for iterations
INVALID_ROADTYPE = 63, ///< flag for invalid roadtype
};
DECLARE_POSTFIX_INCREMENT(RoadType)
template <> struct EnumPropsT<RoadType> : MakeEnumPropsT<RoadType, byte, ROADTYPE_BEGIN, ROADTYPE_END, INVALID_ROADTYPE, 6> {};
/**
* The different roadtypes we support, but then a bitmask of them.
* @note Must be treated as a uint64 type, narrowing it causes bit membership tests to give wrong results.
*/
enum RoadTypes : uint64 {
ROADTYPES_NONE = 0, ///< No roadtypes
ROADTYPES_ROAD = 1 << ROADTYPE_ROAD, ///< Road
ROADTYPES_TRAM = 1 << ROADTYPE_TRAM, ///< Trams
INVALID_ROADTYPES = UINT64_MAX, ///< Invalid roadtypes
};
DECLARE_ENUM_AS_BIT_SET(RoadTypes)
/**
* Enumeration for the road parts on a tile.
*
* This enumeration defines the possible road parts which
* can be build on a tile.
*/
enum RoadBits : byte {
ROAD_NONE = 0U, ///< No road-part is build
ROAD_NW = 1U, ///< North-west part
ROAD_SW = 2U, ///< South-west part
ROAD_SE = 4U, ///< South-east part
ROAD_NE = 8U, ///< North-east part
ROAD_X = ROAD_SW | ROAD_NE, ///< Full road along the x-axis (south-west + north-east)
ROAD_Y = ROAD_NW | ROAD_SE, ///< Full road along the y-axis (north-west + south-east)
ROAD_N = ROAD_NE | ROAD_NW, ///< Road at the two northern edges
ROAD_E = ROAD_NE | ROAD_SE, ///< Road at the two eastern edges
ROAD_S = ROAD_SE | ROAD_SW, ///< Road at the two southern edges
ROAD_W = ROAD_NW | ROAD_SW, ///< Road at the two western edges
ROAD_ALL = ROAD_X | ROAD_Y, ///< Full 4-way crossing
ROAD_END = ROAD_ALL + 1, ///< Out-of-range roadbits, used for iterations
};
DECLARE_ENUM_AS_BIT_SET(RoadBits)
template <> struct EnumPropsT<RoadBits> : MakeEnumPropsT<RoadBits, byte, ROAD_NONE, ROAD_END, ROAD_NONE, 4> {};
/** Which directions are disallowed ? */
enum DisallowedRoadDirections : byte {
DRD_NONE, ///< None of the directions are disallowed
DRD_SOUTHBOUND, ///< All southbound traffic is disallowed
DRD_NORTHBOUND, ///< All northbound traffic is disallowed
DRD_BOTH, ///< All directions are disallowed
DRD_END, ///< Sentinel
};
DECLARE_ENUM_AS_BIT_SET(DisallowedRoadDirections)
/** Helper information for extract tool. */
template <> struct EnumPropsT<DisallowedRoadDirections> : MakeEnumPropsT<DisallowedRoadDirections, byte, DRD_NONE, DRD_END, DRD_END, 2> {};
#endif /* ROAD_TYPE_H */
|