OpenTTD Source 20250905-master-g122023be8d
bridge_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 BRIDGE_TYPE_H
11#define BRIDGE_TYPE_H
12
13#include "core/enum_type.hpp"
14
15using BridgeType = uint;
16
22enum BridgePieces : uint8_t {
23 BRIDGE_PIECE_NORTH = 0,
24 BRIDGE_PIECE_SOUTH,
25 BRIDGE_PIECE_INNER_NORTH,
26 BRIDGE_PIECE_INNER_SOUTH,
27 BRIDGE_PIECE_MIDDLE_ODD,
28 BRIDGE_PIECE_MIDDLE_EVEN,
29 BRIDGE_PIECE_HEAD,
30 NUM_BRIDGE_PIECES,
31};
32
34
35
36static constexpr uint NUM_BRIDGE_MIDDLE_PIECES = NUM_BRIDGE_PIECES - 1;
37
39enum class BridgePillarFlag : uint8_t {
40 /* Corners are in the same order as Corner enum. */
41 CornerW = 0,
42 CornerS = 1,
43 CornerE = 2,
44 CornerN = 3,
45 /* Edges are in the same order as DiagDirection enum. */
46 EdgeNE = 4, //< Northeast edge is obstructed.
47 EdgeSE = 5, //< Southeast edge is obstructed.
48 EdgeSW = 6, //< Southwest edge is obstructed.
49 EdgeNW = 7, //< Northwest edge is obstructed.
50};
52
53static constexpr BridgePillarFlags BRIDGEPILLARFLAGS_ALL{
55 BridgePillarFlag::EdgeNE, BridgePillarFlag::EdgeSE, BridgePillarFlag::EdgeSW, BridgePillarFlag::EdgeNW,
56};
57
60 uint8_t height = 0;
61 BridgePillarFlags disallowed_pillars = BRIDGEPILLARFLAGS_ALL;
62};
63
64#endif /* BRIDGE_TYPE_H */
static constexpr uint NUM_BRIDGE_MIDDLE_PIECES
Number of bridge middles pieces.
Definition bridge_type.h:36
BridgePieces
This enum is related to the definition of bridge pieces, which is used to determine the proper sprite...
Definition bridge_type.h:22
BridgePillarFlag
Obstructed bridge pillars information.
Definition bridge_type.h:39
@ CornerN
North corner is obstructed.
@ CornerS
South corner is obstructed.
@ CornerE
East corner is obstructed.
@ CornerW
West corner is obstructed.
uint BridgeType
Bridge spec number.
Definition bridge_type.h:15
Type (helpers) for enums.
#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
Information about a tile structure that may have a bridge above.
Definition bridge_type.h:59
uint8_t height
Minimum height for a bridge above. 0 means a bridge is not allowed.
Definition bridge_type.h:60
BridgePillarFlags disallowed_pillars
Disallowed pillar flags for a bridge above.
Definition bridge_type.h:61