OpenTTD Source: src/rail.cpp Source File

OpenTTD Source 15.0-beta1

rail.cpp
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#include "stdafx.h"
11#include "station_map.h"
12#include "tunnelbridge_map.h"
13#include "timer/timer_game_calendar.h"
14#include "company_func.h"
15#include "company_base.h"
16#include "engine_base.h"
17
18#include "safeguards.h"
19
20/* XXX: Below 3 tables store duplicate data. Maybe remove some? */
21/* Maps a trackdir to the bit that stores its status in the map arrays, in the
22 * direction along with the trackdir */
23extern const uint8_t _signal_along_trackdir[TRACKDIR_END] = {
24 0x8, 0x8, 0x8, 0x2, 0x4, 0x1, 0, 0,
25 0x4, 0x4, 0x4, 0x1, 0x8, 0x2
26};
27
28/* Maps a trackdir to the bit that stores its status in the map arrays, in the
29 * direction against the trackdir */
30extern const uint8_t _signal_against_trackdir[TRACKDIR_END] = {
31 0x4, 0x4, 0x4, 0x1, 0x8, 0x2, 0, 0,
32 0x8, 0x8, 0x8, 0x2, 0x4, 0x1
33};
34
35/* Maps a Track to the bits that store the status of the two signals that can
36 * be present on the given track */
37extern const uint8_t _signal_on_track[] = {
38 0xC, 0xC, 0xC, 0x3, 0xC, 0x3
39};
40
41/* Maps a diagonal direction to the all trackdirs that are connected to any
42 * track entering in this direction (including those making 90 degree turns)
43 */
44extern const TrackdirBits _exitdir_reaches_trackdirs[] = {
45 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_LOWER_E | TRACKDIR_BIT_LEFT_N, // DIAGDIR_NE
46 TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_LEFT_S | TRACKDIR_BIT_UPPER_E, // DIAGDIR_SE
47 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_RIGHT_S, // DIAGDIR_SW
48 TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_LOWER_W // DIAGDIR_NW
49};
50
51extern const Trackdir _next_trackdir[TRACKDIR_END] = {
52 TRACKDIR_X_NE, TRACKDIR_Y_SE, TRACKDIR_LOWER_E, TRACKDIR_UPPER_E, TRACKDIR_RIGHT_S, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR,
53 TRACKDIR_X_SW, TRACKDIR_Y_NW, TRACKDIR_LOWER_W, TRACKDIR_UPPER_W, TRACKDIR_RIGHT_N, TRACKDIR_LEFT_N
54};
55
56/* Maps a trackdir to all trackdirs that make 90 deg turns with it. */
57extern const TrackdirBits _track_crosses_trackdirs[TRACK_END] = {
58 TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_Y_NW, // TRACK_X
59 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_X_SW, // TRACK_Y
60 TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_RIGHT_S | TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_LEFT_S, // TRACK_UPPER
61 TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_RIGHT_S | TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_LEFT_S, // TRACK_LOWER
62 TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_UPPER_E | TRACKDIR_BIT_LOWER_W | TRACKDIR_BIT_LOWER_E, // TRACK_LEFT
63 TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_UPPER_E | TRACKDIR_BIT_LOWER_W | TRACKDIR_BIT_LOWER_E // TRACK_RIGHT
64};
65
66/* Maps a track to all tracks that make 90 deg turns with it. */
67extern const TrackBits _track_crosses_tracks[] = {
68 TRACK_BIT_Y, // TRACK_X
69 TRACK_BIT_X, // TRACK_Y
70 TRACK_BIT_VERT, // TRACK_UPPER
71 TRACK_BIT_VERT, // TRACK_LOWER
72 TRACK_BIT_HORZ, // TRACK_LEFT
73 TRACK_BIT_HORZ // TRACK_RIGHT
74};
75
76/* Maps a trackdir to the (4-way) direction the tile is exited when following
77 * that trackdir */
78extern const DiagDirection _trackdir_to_exitdir[TRACKDIR_END] = {
79 DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_NE,
80 DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE,
81};
82
83extern const Trackdir _track_exitdir_to_trackdir[][DIAGDIR_END] = {
84 {TRACKDIR_X_NE, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR},
85 {INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, TRACKDIR_Y_NW},
86 {TRACKDIR_UPPER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_UPPER_W},
87 {INVALID_TRACKDIR, TRACKDIR_LOWER_E, TRACKDIR_LOWER_W, INVALID_TRACKDIR},
88 {INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LEFT_S, TRACKDIR_LEFT_N},
89 {TRACKDIR_RIGHT_N, TRACKDIR_RIGHT_S, INVALID_TRACKDIR, INVALID_TRACKDIR}
90};
91
92extern const Trackdir _track_enterdir_to_trackdir[][DIAGDIR_END] = {
93 {TRACKDIR_X_NE, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR},
94 {INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, TRACKDIR_Y_NW},
95 {INVALID_TRACKDIR, TRACKDIR_UPPER_E, TRACKDIR_UPPER_W, INVALID_TRACKDIR},
96 {TRACKDIR_LOWER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_W},
97 {TRACKDIR_LEFT_N, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR},
98 {INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_RIGHT_S, TRACKDIR_RIGHT_N}
99};
100
101extern const Trackdir _track_direction_to_trackdir[][DIR_END] = {
102 {INVALID_TRACKDIR, TRACKDIR_X_NE, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR, INVALID_TRACKDIR},
103 {INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_Y_NW},
104 {INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_UPPER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_UPPER_W, INVALID_TRACKDIR},
105 {INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_W, INVALID_TRACKDIR},
106 {TRACKDIR_LEFT_N, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR},
107 {TRACKDIR_RIGHT_N, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_RIGHT_S, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR}
108};
109
110extern const Trackdir _dir_to_diag_trackdir[] = {
111 TRACKDIR_X_NE, TRACKDIR_Y_SE, TRACKDIR_X_SW, TRACKDIR_Y_NW,
112};
113
114extern const TrackBits _corner_to_trackbits[] = {
115 TRACK_BIT_LEFT, TRACK_BIT_LOWER, TRACK_BIT_RIGHT, TRACK_BIT_UPPER,
116};
117
118extern const TrackdirBits _uphill_trackdirs[] = {
119 TRACKDIR_BIT_NONE ,
120 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW,
121 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_SE,
122 TRACKDIR_BIT_X_SW ,
123 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE,
124 TRACKDIR_BIT_NONE ,
125 TRACKDIR_BIT_Y_SE ,
126 TRACKDIR_BIT_NONE ,
127 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_NW,
128 TRACKDIR_BIT_Y_NW ,
129 TRACKDIR_BIT_NONE ,
130 TRACKDIR_BIT_NONE ,
131 TRACKDIR_BIT_X_NE ,
132 TRACKDIR_BIT_NONE ,
133 TRACKDIR_BIT_NONE ,
134 TRACKDIR_BIT_NONE ,
135 TRACKDIR_BIT_NONE ,
136 TRACKDIR_BIT_NONE ,
137 TRACKDIR_BIT_NONE ,
138 TRACKDIR_BIT_NONE ,
139 TRACKDIR_BIT_NONE ,
140 TRACKDIR_BIT_NONE ,
141 TRACKDIR_BIT_NONE ,
142 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_SE,
143 TRACKDIR_BIT_NONE ,
144 TRACKDIR_BIT_NONE ,
145 TRACKDIR_BIT_NONE ,
146 TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW,
147 TRACKDIR_BIT_NONE ,
148 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_NW,
149 TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE,
150};
151
155 RailType GetTileRailType(Tile tile)
156{
157 switch (GetTileType(tile)) {
158 case MP_RAILWAY:
159 return GetRailType(tile);
160
161 case MP_ROAD:
162 /* rail/road crossing */
163 if (IsLevelCrossing(tile)) return GetRailType(tile);
164 break;
165
166 case MP_STATION:
167 if (HasStationRail(tile)) return GetRailType(tile);
168 break;
169
170 case MP_TUNNELBRIDGE:
171 if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) return GetRailType(tile);
172 break;
173
174 default:
175 break;
176 }
177 return INVALID_RAILTYPE;
178}
179
186 bool HasRailTypeAvail(const CompanyID company, const RailType railtype)
187{
188 return !HasBit(_railtypes_hidden_mask, railtype) && HasBit(Company::Get(company)->avail_railtypes, railtype);
189}
190
196 bool HasAnyRailTypesAvail(const CompanyID company)
197{
198 return (Company::Get(company)->avail_railtypes & ~_railtypes_hidden_mask) != 0;
199}
200
206 bool ValParamRailType(const RailType rail)
207{
208 return rail < RAILTYPE_END && HasRailTypeAvail(_current_company, rail);
209}
210
218 RailTypes AddDateIntroducedRailTypes(RailTypes current, TimerGameCalendar::Date date)
219{
220 RailTypes rts = current;
221
222 for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
223 const RailTypeInfo *rti = GetRailTypeInfo(rt);
224 /* Unused rail type. */
225 if (rti->label == 0) continue;
226
227 /* Not date introduced. */
228 if (!IsInsideMM(rti->introduction_date, 0, CalendarTime::MAX_DATE.base())) continue;
229
230 /* Not yet introduced at this date. */
231 if (rti->introduction_date > date) continue;
232
233 /* Have we introduced all required railtypes? */
234 RailTypes required = rti->introduction_required_railtypes;
235 if ((rts & required) != required) continue;
236
237 rts |= rti->introduces_railtypes;
238 }
239
240 /* When we added railtypes we need to run this method again; the added
241 * railtypes might enable more rail types to become introduced. */
242 return rts == current ? rts : AddDateIntroducedRailTypes(rts, date);
243}
244
251 RailTypes GetCompanyRailTypes(CompanyID company, bool introduces)
252{
253 RailTypes rts = RAILTYPES_NONE;
254
255 for (const Engine *e : Engine::IterateType(VEH_TRAIN)) {
256 const EngineInfo *ei = &e->info;
257
258 if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
259 (HasBit(e->company_avail, company) || TimerGameCalendar::date >= e->intro_date + CalendarTime::DAYS_IN_YEAR)) {
260 const RailVehicleInfo *rvi = &e->u.rail;
261
262 if (rvi->railveh_type != RAILVEH_WAGON) {
263 assert(rvi->railtype < RAILTYPE_END);
264 if (introduces) {
265 rts |= GetRailTypeInfo(rvi->railtype)->introduces_railtypes;
266 } else {
267 SetBit(rts, rvi->railtype);
268 }
269 }
270 }
271 }
272
273 if (introduces) return AddDateIntroducedRailTypes(rts, TimerGameCalendar::date);
274 return rts;
275}
276
282 RailTypes GetRailTypes(bool introduces)
283{
284 RailTypes rts = RAILTYPES_NONE;
285
286 for (const Engine *e : Engine::IterateType(VEH_TRAIN)) {
287 const EngineInfo *ei = &e->info;
288 if (!HasBit(ei->climates, _settings_game.game_creation.landscape)) continue;
289
290 const RailVehicleInfo *rvi = &e->u.rail;
291 if (rvi->railveh_type != RAILVEH_WAGON) {
292 assert(rvi->railtype < RAILTYPE_END);
293 if (introduces) {
294 rts |= GetRailTypeInfo(rvi->railtype)->introduces_railtypes;
295 } else {
296 SetBit(rts, rvi->railtype);
297 }
298 }
299 }
300
301 if (introduces) return AddDateIntroducedRailTypes(rts, CalendarTime::MAX_DATE);
302 return rts;
303}
304
311 RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels)
312{
313 if (label == 0) return INVALID_RAILTYPE;
314
315 /* Loop through each rail type until the label is found */
316 for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) {
317 const RailTypeInfo *rti = GetRailTypeInfo(r);
318 if (rti->label == label) return r;
319 }
320
321 if (allow_alternate_labels) {
322 /* Test if any rail type defines the label as an alternate. */
323 for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) {
324 const RailTypeInfo *rti = GetRailTypeInfo(r);
325 if (std::ranges::find(rti->alternate_labels, label) != rti->alternate_labels.end()) return r;
326 }
327 }
328
329 /* No matching label was found, so it is invalid */
330 return INVALID_RAILTYPE;
331}
HasBit
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition bitmath_func.hpp:103
SetBit
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
Definition bitmath_func.hpp:121
RailTypeInfo
This struct contains all the info that is needed to draw and construct tracks.
Definition rail.h:127
RailTypeInfo::introduction_date
TimerGameCalendar::Date introduction_date
Introduction date.
Definition rail.h:255
RailTypeInfo::introduces_railtypes
RailTypes introduces_railtypes
Bitmask of which other railtypes are introduced when this railtype is introduced.
Definition rail.h:266
RailTypeInfo::introduction_required_railtypes
RailTypes introduction_required_railtypes
Bitmask of railtypes that are required for this railtype to be introduced at a given introduction_dat...
Definition rail.h:261
RailTypeInfo::label
RailTypeLabel label
Unique 32 bit rail type identifier.
Definition rail.h:236
RailTypeInfo::alternate_labels
RailTypeLabelList alternate_labels
Rail type labels this type provides in addition to the main label.
Definition rail.h:241
Tile
Wrapper class to abstract away the way the tiles are stored.
Definition map_func.h:25
TimerGameCalendar::date
static Date date
Current date in days (day counter).
Definition timer_game_calendar.h:33
TimerGameConst< struct Calendar >::MAX_DATE
static constexpr TimerGame< struct Calendar >::Date MAX_DATE
The date of the last day of the max year.
Definition timer_game_common.h:187
TimerGameConst< struct Calendar >::DAYS_IN_YEAR
static constexpr int DAYS_IN_YEAR
days per year
Definition timer_game_common.h:149
company_base.h
Definition of stuff that is very close to a company, like the company struct itself.
_current_company
CompanyID _current_company
Company currently doing an action.
Definition company_cmd.cpp:53
company_func.h
Functions related to companies.
Owner
Owner
Enum for all companies/owners.
Definition company_type.h:18
DIR_END
@ DIR_END
Used to iterate.
Definition direction_type.h:34
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition direction_type.h:73
DIAGDIR_NE
@ DIAGDIR_NE
Northeast, upper right on your monitor.
Definition direction_type.h:75
DIAGDIR_NW
@ DIAGDIR_NW
Northwest.
Definition direction_type.h:78
DIAGDIR_SE
@ DIAGDIR_SE
Southeast.
Definition direction_type.h:76
DIAGDIR_END
@ DIAGDIR_END
Used for iterations.
Definition direction_type.h:79
DIAGDIR_SW
@ DIAGDIR_SW
Southwest.
Definition direction_type.h:77
engine_base.h
Base class for engines.
RAILVEH_WAGON
@ RAILVEH_WAGON
simple wagon, not motorized
Definition engine_type.h:29
IsInsideMM
constexpr bool IsInsideMM(const T x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
Definition math_func.hpp:268
GetCompanyRailTypes
RailTypes GetCompanyRailTypes(CompanyID company, bool introduces)
Get the rail types the given company can build.
Definition rail.cpp:251
HasAnyRailTypesAvail
bool HasAnyRailTypesAvail(const CompanyID company)
Test if any buildable railtype is available for a company.
Definition rail.cpp:196
HasRailTypeAvail
bool HasRailTypeAvail(const CompanyID company, const RailType railtype)
Finds out if a company has a certain buildable railtype available.
Definition rail.cpp:186
GetRailTypeByLabel
RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels)
Get the rail type for a given label.
Definition rail.cpp:311
GetTileRailType
RailType GetTileRailType(Tile tile)
Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.
Definition rail.cpp:155
AddDateIntroducedRailTypes
RailTypes AddDateIntroducedRailTypes(RailTypes current, TimerGameCalendar::Date date)
Add the rail types that are to be introduced at the given date.
Definition rail.cpp:218
GetRailTypes
RailTypes GetRailTypes(bool introduces)
Get list of rail types, regardless of company availability.
Definition rail.cpp:282
ValParamRailType
bool ValParamRailType(const RailType rail)
Validate functions for rail building.
Definition rail.cpp:206
GetRailTypeInfo
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
Definition rail.h:307
GetRailType
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
Definition rail_map.h:115
RailTypes
RailTypes
Allow incrementing of Track variables.
Definition rail_type.h:44
RAILTYPES_NONE
@ RAILTYPES_NONE
No rail types.
Definition rail_type.h:45
RailType
RailType
Enumeration for all possible railtypes.
Definition rail_type.h:27
RAILTYPE_BEGIN
@ RAILTYPE_BEGIN
Used for iterations.
Definition rail_type.h:28
RAILTYPE_END
@ RAILTYPE_END
Used for iterations.
Definition rail_type.h:33
INVALID_RAILTYPE
@ INVALID_RAILTYPE
Flag for invalid railtype.
Definition rail_type.h:34
IsLevelCrossing
bool IsLevelCrossing(Tile t)
Return whether a tile is a level crossing.
Definition road_map.h:85
safeguards.h
A number of safeguards to prevent using unsafe methods.
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:57
station_map.h
Maps accessors for stations.
HasStationRail
bool HasStationRail(Tile t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
Definition station_map.h:135
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
EngineInfo
Information about a vehicle.
Definition engine_type.h:148
EngineInfo::climates
uint8_t climates
Climates supported by the engine.
Definition engine_type.h:154
Engine
Definition engine_base.h:37
Engine::IterateType
static Pool::IterateWrapperFiltered< Engine, EngineTypeFilter > IterateType(VehicleType vt, size_t from=0)
Returns an iterable ensemble of all valid engines of the given type.
Definition engine_base.h:190
GameCreationSettings::landscape
uint8_t landscape
the landscape we're currently in
Definition settings_type.h:368
GameSettings::game_creation
GameCreationSettings game_creation
settings used during the creation of a game (map)
Definition settings_type.h:593
Pool::PoolItem<&_company_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition pool_type.hpp:339
RailVehicleInfo
Information about a rail vehicle.
Definition engine_type.h:42
RailVehicleInfo::railtype
RailType railtype
Railtype, mangled if elrail is disabled.
Definition engine_type.h:46
GetTileType
static debug_inline TileType GetTileType(Tile tile)
Get the tiletype of a given tile.
Definition tile_map.h:96
MP_ROAD
@ MP_ROAD
A tile with road (or tram tracks)
Definition tile_type.h:50
MP_STATION
@ MP_STATION
A tile of a station.
Definition tile_type.h:53
MP_TUNNELBRIDGE
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
Definition tile_type.h:57
MP_RAILWAY
@ MP_RAILWAY
A railway.
Definition tile_type.h:49
timer_game_calendar.h
Definition of the game-calendar-timer.
TrackBits
TrackBits
Allow incrementing of Track variables.
Definition track_type.h:35
TRACK_BIT_UPPER
@ TRACK_BIT_UPPER
Upper track.
Definition track_type.h:39
TRACK_BIT_LEFT
@ TRACK_BIT_LEFT
Left track.
Definition track_type.h:41
TRACK_BIT_Y
@ TRACK_BIT_Y
Y-axis track.
Definition track_type.h:38
TRACK_BIT_HORZ
@ TRACK_BIT_HORZ
Upper and lower track.
Definition track_type.h:44
TRACK_BIT_X
@ TRACK_BIT_X
X-axis track.
Definition track_type.h:37
TRACK_BIT_LOWER
@ TRACK_BIT_LOWER
Lower track.
Definition track_type.h:40
TRACK_BIT_RIGHT
@ TRACK_BIT_RIGHT
Right track.
Definition track_type.h:42
TRACK_BIT_VERT
@ TRACK_BIT_VERT
Left and right track.
Definition track_type.h:45
Trackdir
Trackdir
Enumeration for tracks and directions.
Definition track_type.h:67
TRACKDIR_X_NE
@ TRACKDIR_X_NE
X-axis and direction to north-east.
Definition track_type.h:69
TRACKDIR_LOWER_E
@ TRACKDIR_LOWER_E
Lower track and direction to east.
Definition track_type.h:72
TRACKDIR_RIGHT_N
@ TRACKDIR_RIGHT_N
Right track and direction to north.
Definition track_type.h:82
INVALID_TRACKDIR
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
Definition track_type.h:86
TRACKDIR_UPPER_E
@ TRACKDIR_UPPER_E
Upper track and direction to east.
Definition track_type.h:71
TRACKDIR_Y_SE
@ TRACKDIR_Y_SE
Y-axis and direction to south-east.
Definition track_type.h:70
TRACKDIR_LEFT_S
@ TRACKDIR_LEFT_S
Left track and direction to south.
Definition track_type.h:73
TRACKDIR_UPPER_W
@ TRACKDIR_UPPER_W
Upper track and direction to west.
Definition track_type.h:79
TRACKDIR_X_SW
@ TRACKDIR_X_SW
X-axis and direction to south-west.
Definition track_type.h:77
TRACKDIR_LOWER_W
@ TRACKDIR_LOWER_W
Lower track and direction to west.
Definition track_type.h:80
TRACKDIR_Y_NW
@ TRACKDIR_Y_NW
Y-axis and direction to north-west.
Definition track_type.h:78
TRACKDIR_END
@ TRACKDIR_END
Used for iterations.
Definition track_type.h:85
TRACKDIR_RIGHT_S
@ TRACKDIR_RIGHT_S
Right track and direction to south.
Definition track_type.h:74
TRACKDIR_LEFT_N
@ TRACKDIR_LEFT_N
Left track and direction to north.
Definition track_type.h:81
TrackdirBits
TrackdirBits
Allow incrementing of Trackdir variables.
Definition track_type.h:98
TRACKDIR_BIT_LEFT_S
@ TRACKDIR_BIT_LEFT_S
Track left, direction south.
Definition track_type.h:104
TRACKDIR_BIT_Y_NW
@ TRACKDIR_BIT_Y_NW
Track y-axis, direction north-west.
Definition track_type.h:108
TRACKDIR_BIT_UPPER_E
@ TRACKDIR_BIT_UPPER_E
Track upper, direction east.
Definition track_type.h:102
TRACKDIR_BIT_X_NE
@ TRACKDIR_BIT_X_NE
Track x-axis, direction north-east.
Definition track_type.h:100
TRACKDIR_BIT_LOWER_E
@ TRACKDIR_BIT_LOWER_E
Track lower, direction east.
Definition track_type.h:103
TRACKDIR_BIT_LEFT_N
@ TRACKDIR_BIT_LEFT_N
Track left, direction north.
Definition track_type.h:111
TRACKDIR_BIT_RIGHT_S
@ TRACKDIR_BIT_RIGHT_S
Track right, direction south.
Definition track_type.h:105
TRACKDIR_BIT_Y_SE
@ TRACKDIR_BIT_Y_SE
Track y-axis, direction south-east.
Definition track_type.h:101
TRACKDIR_BIT_NONE
@ TRACKDIR_BIT_NONE
No track build.
Definition track_type.h:99
TRACKDIR_BIT_RIGHT_N
@ TRACKDIR_BIT_RIGHT_N
Track right, direction north.
Definition track_type.h:112
TRACKDIR_BIT_UPPER_W
@ TRACKDIR_BIT_UPPER_W
Track upper, direction west.
Definition track_type.h:109
TRACKDIR_BIT_LOWER_W
@ TRACKDIR_BIT_LOWER_W
Track lower, direction west.
Definition track_type.h:110
TRACKDIR_BIT_X_SW
@ TRACKDIR_BIT_X_SW
Track x-axis, direction south-west.
Definition track_type.h:107
TRACK_END
@ TRACK_END
Used for iterations.
Definition track_type.h:27
TRANSPORT_RAIL
@ TRANSPORT_RAIL
Transport by train.
Definition transport_type.h:27
tunnelbridge_map.h
Functions that have tunnels and bridges in common.
GetTunnelBridgeTransportType
TransportType GetTunnelBridgeTransportType(Tile t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
Definition tunnelbridge_map.h:39
VEH_TRAIN
@ VEH_TRAIN
Train vehicle type.
Definition vehicle_type.h:24