OpenTTD: src/slope_type.h Source File

OpenTTD

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

- File List
- Globals

slope_type.h
Go to the documentation of this file.
1 /* $Id: slope_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
16 #ifndef SLOPE_TYPE_H
17 #define SLOPE_TYPE_H
18
19 #include "core/enum_type.hpp"
20
24 enum Corner {
25 CORNER_W = 0,
26 CORNER_S = 1,
27 CORNER_E = 2,
28 CORNER_N = 3,
29 CORNER_END,
30 CORNER_INVALID = 0xFF
31 };
32
33
50 enum Slope {
51 SLOPE_FLAT = 0x00,
52 SLOPE_W = 0x01,
53 SLOPE_S = 0x02,
54 SLOPE_E = 0x04,
55 SLOPE_N = 0x08,
56 SLOPE_STEEP = 0x10,
57 SLOPE_NW = SLOPE_N | SLOPE_W,
58 SLOPE_SW = SLOPE_S | SLOPE_W,
59 SLOPE_SE = SLOPE_S | SLOPE_E,
60 SLOPE_NE = SLOPE_N | SLOPE_E,
61 SLOPE_EW = SLOPE_E | SLOPE_W,
62 SLOPE_NS = SLOPE_N | SLOPE_S,
63 SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W,
64 SLOPE_NWS = SLOPE_N | SLOPE_W | SLOPE_S,
65 SLOPE_WSE = SLOPE_W | SLOPE_S | SLOPE_E,
66 SLOPE_SEN = SLOPE_S | SLOPE_E | SLOPE_N,
67 SLOPE_ENW = SLOPE_E | SLOPE_N | SLOPE_W,
68 SLOPE_STEEP_W = SLOPE_STEEP | SLOPE_NWS,
69 SLOPE_STEEP_S = SLOPE_STEEP | SLOPE_WSE,
70 SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN,
71 SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW,
72
73 SLOPE_HALFTILE = 0x20,
74 SLOPE_HALFTILE_MASK = 0xE0,
75 SLOPE_HALFTILE_W = SLOPE_HALFTILE | (CORNER_W << 6),
76 SLOPE_HALFTILE_S = SLOPE_HALFTILE | (CORNER_S << 6),
77 SLOPE_HALFTILE_E = SLOPE_HALFTILE | (CORNER_E << 6),
78 SLOPE_HALFTILE_N = SLOPE_HALFTILE | (CORNER_N << 6),
79 };
80 DECLARE_ENUM_AS_BIT_SET(Slope)
81
82
86 #define M(x) (1 << (x))
87
88 static const uint32 VALID_LEVEL_CROSSING_SLOPES = M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT);
89 #undef M
90
91
95 enum Foundation {
96 FOUNDATION_NONE,
97 FOUNDATION_LEVELED,
98 FOUNDATION_INCLINED_X,
99 FOUNDATION_INCLINED_Y,
100 FOUNDATION_STEEP_LOWER,
101
102 /* Halftile foundations */
103 FOUNDATION_STEEP_BOTH,
104 FOUNDATION_HALFTILE_W,
105 FOUNDATION_HALFTILE_S,
106 FOUNDATION_HALFTILE_E,
107 FOUNDATION_HALFTILE_N,
108
109 /* Special anti-zig-zag foundations for single horizontal/vertical track */
110 FOUNDATION_RAIL_W,
111 FOUNDATION_RAIL_S,
112 FOUNDATION_RAIL_E,
113 FOUNDATION_RAIL_N,
114
115 FOUNDATION_INVALID = 0xFF,
116 };
117
118 #endif /* SLOPE_TYPE_H */