OpenTTD Source  1.11.2
rail_map.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 RAIL_MAP_H
11 #define RAIL_MAP_H
12 
13 #include "rail_type.h"
14 #include "depot_type.h"
15 #include "signal_func.h"
16 #include "track_func.h"
17 #include "tile_map.h"
18 #include "water_map.h"
19 #include "signal_type.h"
20 
21 
27 };
28 
37 {
38  assert(IsTileType(t, MP_RAILWAY));
39  return (RailTileType)GB(_m[t].m5, 6, 2);
40 }
41 
49 static inline bool IsPlainRail(TileIndex t)
50 {
52  return rtt == RAIL_TILE_NORMAL || rtt == RAIL_TILE_SIGNALS;
53 }
54 
60 static inline bool IsPlainRailTile(TileIndex t)
61 {
62  return IsTileType(t, MP_RAILWAY) && IsPlainRail(t);
63 }
64 
65 
72 static inline bool HasSignals(TileIndex t)
73 {
75 }
76 
83 static inline void SetHasSignals(TileIndex tile, bool signals)
84 {
85  assert(IsPlainRailTile(tile));
86  SB(_m[tile].m5, 6, 1, signals);
87 }
88 
95 static inline bool IsRailDepot(TileIndex t)
96 {
97  return GetRailTileType(t) == RAIL_TILE_DEPOT;
98 }
99 
105 static inline bool IsRailDepotTile(TileIndex t)
106 {
107  return IsTileType(t, MP_RAILWAY) && IsRailDepot(t);
108 }
109 
116 {
117  return (RailType)GB(_me[t].m8, 0, 6);
118 }
119 
125 static inline void SetRailType(TileIndex t, RailType r)
126 {
127  SB(_me[t].m8, 0, 6, r);
128 }
129 
130 
136 static inline TrackBits GetTrackBits(TileIndex tile)
137 {
138  assert(IsPlainRailTile(tile));
139  return (TrackBits)GB(_m[tile].m5, 0, 6);
140 }
141 
147 static inline void SetTrackBits(TileIndex t, TrackBits b)
148 {
149  assert(IsPlainRailTile(t));
150  SB(_m[t].m5, 0, 6, b);
151 }
152 
160 static inline bool HasTrack(TileIndex tile, Track track)
161 {
162  return HasBit(GetTrackBits(tile), track);
163 }
164 
172 {
173  return (DiagDirection)GB(_m[t].m5, 0, 2);
174 }
175 
183 {
185 }
186 
187 
195 {
196  assert(IsPlainRailTile(t));
197  byte track_b = GB(_m[t].m2, 8, 3);
198  Track track = (Track)(track_b - 1); // map array saves Track+1
199  if (track_b == 0) return TRACK_BIT_NONE;
200  return (TrackBits)(TrackToTrackBits(track) | (HasBit(_m[t].m2, 11) ? TrackToTrackBits(TrackToOppositeTrack(track)) : 0));
201 }
202 
209 static inline void SetTrackReservation(TileIndex t, TrackBits b)
210 {
211  assert(IsPlainRailTile(t));
212  assert(b != INVALID_TRACK_BIT);
213  assert(!TracksOverlap(b));
214  Track track = RemoveFirstTrack(&b);
215  SB(_m[t].m2, 8, 3, track == INVALID_TRACK ? 0 : track + 1);
216  SB(_m[t].m2, 11, 1, (byte)(b != TRACK_BIT_NONE));
217 }
218 
226 static inline bool TryReserveTrack(TileIndex tile, Track t)
227 {
228  assert(HasTrack(tile, t));
229  TrackBits bits = TrackToTrackBits(t);
231  if ((res & bits) != TRACK_BIT_NONE) return false; // already reserved
232  res |= bits;
233  if (TracksOverlap(res)) return false; // crossing reservation present
234  SetTrackReservation(tile, res);
235  return true;
236 }
237 
244 static inline void UnreserveTrack(TileIndex tile, Track t)
245 {
246  assert(HasTrack(tile, t));
248  res &= ~TrackToTrackBits(t);
249  SetTrackReservation(tile, res);
250 }
251 
258 static inline bool HasDepotReservation(TileIndex t)
259 {
260  assert(IsRailDepot(t));
261  return HasBit(_m[t].m5, 4);
262 }
263 
270 static inline void SetDepotReservation(TileIndex t, bool b)
271 {
272  assert(IsRailDepot(t));
273  SB(_m[t].m5, 4, 1, (byte)b);
274 }
275 
283 {
285 }
286 
287 
288 static inline bool IsPbsSignal(SignalType s)
289 {
290  return s == SIGTYPE_PBS || s == SIGTYPE_PBS_ONEWAY;
291 }
292 
293 static inline SignalType GetSignalType(TileIndex t, Track track)
294 {
295  assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
296  byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
297  return (SignalType)GB(_m[t].m2, pos, 3);
298 }
299 
300 static inline void SetSignalType(TileIndex t, Track track, SignalType s)
301 {
302  assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
303  byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
304  SB(_m[t].m2, pos, 3, s);
305  if (track == INVALID_TRACK) SB(_m[t].m2, 4, 3, s);
306 }
307 
308 static inline bool IsPresignalEntry(TileIndex t, Track track)
309 {
310  return GetSignalType(t, track) == SIGTYPE_ENTRY || GetSignalType(t, track) == SIGTYPE_COMBO;
311 }
312 
313 static inline bool IsPresignalExit(TileIndex t, Track track)
314 {
315  return GetSignalType(t, track) == SIGTYPE_EXIT || GetSignalType(t, track) == SIGTYPE_COMBO;
316 }
317 
319 static inline bool IsOnewaySignal(TileIndex t, Track track)
320 {
321  return GetSignalType(t, track) != SIGTYPE_PBS;
322 }
323 
324 static inline void CycleSignalSide(TileIndex t, Track track)
325 {
326  byte sig;
327  byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 6;
328 
329  sig = GB(_m[t].m3, pos, 2);
330  if (--sig == 0) sig = IsPbsSignal(GetSignalType(t, track)) ? 2 : 3;
331  SB(_m[t].m3, pos, 2, sig);
332 }
333 
334 static inline SignalVariant GetSignalVariant(TileIndex t, Track track)
335 {
336  byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3;
337  return (SignalVariant)GB(_m[t].m2, pos, 1);
338 }
339 
340 static inline void SetSignalVariant(TileIndex t, Track track, SignalVariant v)
341 {
342  byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3;
343  SB(_m[t].m2, pos, 1, v);
344  if (track == INVALID_TRACK) SB(_m[t].m2, 7, 1, v);
345 }
346 
352 static inline void SetSignalStates(TileIndex tile, uint state)
353 {
354  SB(_m[tile].m4, 4, 4, state);
355 }
356 
362 static inline uint GetSignalStates(TileIndex tile)
363 {
364  return GB(_m[tile].m4, 4, 4);
365 }
366 
373 static inline SignalState GetSingleSignalState(TileIndex t, byte signalbit)
374 {
375  return (SignalState)HasBit(GetSignalStates(t), signalbit);
376 }
377 
383 static inline void SetPresentSignals(TileIndex tile, uint signals)
384 {
385  SB(_m[tile].m3, 4, 4, signals);
386 }
387 
393 static inline uint GetPresentSignals(TileIndex tile)
394 {
395  return GB(_m[tile].m3, 4, 4);
396 }
397 
404 static inline bool IsSignalPresent(TileIndex t, byte signalbit)
405 {
406  return HasBit(GetPresentSignals(t), signalbit);
407 }
408 
413 static inline bool HasSignalOnTrack(TileIndex tile, Track track)
414 {
415  assert(IsValidTrack(track));
416  return GetRailTileType(tile) == RAIL_TILE_SIGNALS && (GetPresentSignals(tile) & SignalOnTrack(track)) != 0;
417 }
418 
426 static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
427 {
428  assert (IsValidTrackdir(trackdir));
429  return GetRailTileType(tile) == RAIL_TILE_SIGNALS && GetPresentSignals(tile) & SignalAlongTrackdir(trackdir);
430 }
431 
439 {
440  assert(IsValidTrackdir(trackdir));
441  assert(HasSignalOnTrack(tile, TrackdirToTrack(trackdir)));
442  return GetSignalStates(tile) & SignalAlongTrackdir(trackdir) ?
444 }
445 
449 static inline void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, SignalState state)
450 {
451  if (state == SIGNAL_STATE_GREEN) { // set 1
452  SetSignalStates(tile, GetSignalStates(tile) | SignalAlongTrackdir(trackdir));
453  } else {
454  SetSignalStates(tile, GetSignalStates(tile) & ~SignalAlongTrackdir(trackdir));
455  }
456 }
457 
463 static inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
464 {
465  return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, td) &&
466  IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td)));
467 }
468 
476 {
477  return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, ReverseTrackdir(td)) &&
478  !HasSignalOnTrackdir(tile, td) && IsOnewaySignal(tile, TrackdirToTrack(td));
479 }
480 
481 
483 
501 };
502 
503 static inline void SetRailGroundType(TileIndex t, RailGroundType rgt)
504 {
505  SB(_m[t].m4, 0, 4, rgt);
506 }
507 
508 static inline RailGroundType GetRailGroundType(TileIndex t)
509 {
510  return (RailGroundType)GB(_m[t].m4, 0, 4);
511 }
512 
513 static inline bool IsSnowRailGround(TileIndex t)
514 {
515  return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT;
516 }
517 
518 
519 static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r)
520 {
522  SetTileOwner(t, o);
523  SetDockingTile(t, false);
524  _m[t].m2 = 0;
525  _m[t].m3 = 0;
526  _m[t].m4 = 0;
527  _m[t].m5 = RAIL_TILE_NORMAL << 6 | b;
528  SB(_me[t].m6, 2, 4, 0);
529  _me[t].m7 = 0;
530  _me[t].m8 = r;
531 }
532 
533 
534 static inline void MakeRailDepot(TileIndex t, Owner o, DepotID did, DiagDirection d, RailType r)
535 {
537  SetTileOwner(t, o);
538  SetDockingTile(t, false);
539  _m[t].m2 = did;
540  _m[t].m3 = 0;
541  _m[t].m4 = 0;
542  _m[t].m5 = RAIL_TILE_DEPOT << 6 | d;
543  SB(_me[t].m6, 2, 4, 0);
544  _me[t].m7 = 0;
545  _me[t].m8 = r;
546 }
547 
548 #endif /* RAIL_MAP_H */
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:83
TRACK_BIT_NONE
@ TRACK_BIT_NONE
No track.
Definition: track_type.h:39
GB
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
Definition: bitmath_func.hpp:32
RAIL_GROUND_HALF_SNOW
@ RAIL_GROUND_HALF_SNOW
Snow only on higher part of slope (steep or one corner raised)
Definition: rail_map.h:500
HasSignalOnTrack
static bool HasSignalOnTrack(TileIndex tile, Track track)
Checks for the presence of signals (either way) on the given track on the given rail tile.
Definition: rail_map.h:413
SetTileType
static void SetTileType(TileIndex tile, TileType type)
Set the type of a tile.
Definition: tile_map.h:131
RAIL_GROUND_FENCE_SE
@ RAIL_GROUND_FENCE_SE
Grass with a fence at the SE edge.
Definition: rail_map.h:489
SetTrackReservation
static void SetTrackReservation(TileIndex t, TrackBits b)
Sets the reserved track bits of the tile.
Definition: rail_map.h:209
TRACK_LOWER
@ TRACK_LOWER
Track in the lower corner of the tile (south)
Definition: track_type.h:24
RAIL_TILE_SIGNALS
@ RAIL_TILE_SIGNALS
Normal rail tile with signals.
Definition: rail_map.h:25
DepotID
uint16 DepotID
Type for the unique identifier of depots.
Definition: depot_type.h:13
RAIL_GROUND_FENCE_NW
@ RAIL_GROUND_FENCE_NW
Grass with a fence at the NW edge.
Definition: rail_map.h:488
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103
_me
TileExtended * _me
Extended Tiles of the map.
Definition: map.cpp:31
SIGNAL_STATE_GREEN
@ SIGNAL_STATE_GREEN
The signal is green.
Definition: signal_type.h:46
RAIL_GROUND_FENCE_VERT1
@ RAIL_GROUND_FENCE_VERT1
Grass with a fence at the eastern side.
Definition: rail_map.h:494
TracksOverlap
static bool TracksOverlap(TrackBits bits)
Checks if the given tracks overlap, ie form a crossing.
Definition: track_func.h:653
MP_RAILWAY
@ MP_RAILWAY
A railway.
Definition: tile_type.h:47
Tile::m2
uint16 m2
Primarily used for indices to towns, industries and stations.
Definition: map_type.h:20
RAIL_GROUND_BARREN
@ RAIL_GROUND_BARREN
Nothing (dirt)
Definition: rail_map.h:486
SignalState
SignalState
These are states in which a signal can be.
Definition: signal_type.h:44
GetTrackBits
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
Definition: rail_map.h:136
RAIL_GROUND_FENCE_SENW
@ RAIL_GROUND_FENCE_SENW
Grass with a fence at the NW and SE edges.
Definition: rail_map.h:490
HasSignals
static bool HasSignals(TileIndex t)
Checks if a rail tile has signals.
Definition: rail_map.h:72
RAIL_GROUND_FENCE_VERT2
@ RAIL_GROUND_FENCE_VERT2
Grass with a fence at the western side.
Definition: rail_map.h:495
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
IsRailDepot
static bool IsRailDepot(TileIndex t)
Is this rail tile a rail depot?
Definition: rail_map.h:95
TRACK_RIGHT
@ TRACK_RIGHT
Track in the right corner of the tile (east)
Definition: track_type.h:26
RemoveFirstTrack
static Track RemoveFirstTrack(TrackBits *tracks)
Removes first Track from TrackBits and returns it.
Definition: track_func.h:139
GetRailDepotDirection
static DiagDirection GetRailDepotDirection(TileIndex t)
Returns the direction the depot is facing to.
Definition: rail_map.h:171
HasPbsSignalOnTrackdir
static bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
Is a pbs signal present along the trackdir?
Definition: rail_map.h:463
GetSingleSignalState
static SignalState GetSingleSignalState(TileIndex t, byte signalbit)
Get the state of a single signal.
Definition: rail_map.h:373
TrackToTrackBits
static TrackBits TrackToTrackBits(Track track)
Maps a Track to the corresponding TrackBits value.
Definition: track_func.h:85
GetRailReservationTrackBits
static TrackBits GetRailReservationTrackBits(TileIndex t)
Returns the reserved track bits of the tile.
Definition: rail_map.h:194
SignalType
SignalType
Type of signal, i.e.
Definition: signal_type.h:23
GetPresentSignals
static uint GetPresentSignals(TileIndex tile)
Get whether the given signals are present (Along/AgainstTrackDir)
Definition: rail_map.h:393
SIGTYPE_PBS
@ SIGTYPE_PBS
normal pbs signal
Definition: signal_type.h:28
RAIL_GROUND_GRASS
@ RAIL_GROUND_GRASS
Grassy.
Definition: rail_map.h:487
tile_map.h
RailType
RailType
Enumeration for all possible railtypes.
Definition: rail_type.h:27
IsValidTrack
static bool IsValidTrack(Track track)
Checks if a Track is valid.
Definition: track_func.h:36
GetRailTileType
static RailTileType GetRailTileType(TileIndex t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
Definition: rail_map.h:36
SIGNAL_STATE_RED
@ SIGNAL_STATE_RED
The signal is red.
Definition: signal_type.h:45
SB
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
Definition: bitmath_func.hpp:58
TrackToOppositeTrack
static Track TrackToOppositeTrack(Track t)
Find the opposite track to a given track.
Definition: track_func.h:239
SIGTYPE_EXIT
@ SIGTYPE_EXIT
presignal block exit
Definition: signal_type.h:26
IsSignalPresent
static bool IsSignalPresent(TileIndex t, byte signalbit)
Checks whether the given signals is present.
Definition: rail_map.h:404
HasSignalOnTrackdir
static bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
Checks for the presence of signals along the given trackdir on the given rail tile.
Definition: rail_map.h:426
SIGTYPE_COMBO
@ SIGTYPE_COMBO
presignal inter-block
Definition: signal_type.h:27
SetHasSignals
static void SetHasSignals(TileIndex tile, bool signals)
Add/remove the 'has signal' bit from the RailTileType.
Definition: rail_map.h:83
SetSignalStates
static void SetSignalStates(TileIndex tile, uint state)
Set the states of the signals (Along/AgainstTrackDir)
Definition: rail_map.h:352
HasDepotReservation
static bool HasDepotReservation(TileIndex t)
Get the reservation state of the depot.
Definition: rail_map.h:258
DiagDirToDiagTrack
static Track DiagDirToDiagTrack(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track incidating with that diagdir.
Definition: track_func.h:520
SetSignalStateByTrackdir
static void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, SignalState state)
Sets the state of the signal along the given trackdir.
Definition: rail_map.h:449
IsRailDepotTile
static bool IsRailDepotTile(TileIndex t)
Is this tile rail tile and a rail depot?
Definition: rail_map.h:105
SetDockingTile
static void SetDockingTile(TileIndex t, bool b)
Set the docking tile state of a tile.
Definition: water_map.h:355
SetTrackBits
static void SetTrackBits(TileIndex t, TrackBits b)
Sets the track bits of the given tile.
Definition: rail_map.h:147
HasOnewaySignalBlockingTrackdir
static bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td)
Is a one-way signal blocking the trackdir? A one-way signal on the trackdir against will block,...
Definition: rail_map.h:475
GetDepotReservationTrackBits
static TrackBits GetDepotReservationTrackBits(TileIndex t)
Get the reserved track bits for a depot.
Definition: rail_map.h:282
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:77
INVALID_TRACK_BIT
@ INVALID_TRACK_BIT
Flag for an invalid trackbits value.
Definition: track_type.h:57
IsOnewaySignal
static bool IsOnewaySignal(TileIndex t, Track track)
One-way signals can't be passed the 'wrong' way.
Definition: rail_map.h:319
IsTileType
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
Definition: tile_map.h:150
SetDepotReservation
static void SetDepotReservation(TileIndex t, bool b)
Set the reservation state of the depot.
Definition: rail_map.h:270
RailGroundType
RailGroundType
The ground 'under' the rail.
Definition: rail_map.h:485
RAIL_GROUND_WATER
@ RAIL_GROUND_WATER
Grass with a fence and shore or water on the free halftile.
Definition: rail_map.h:499
water_map.h
signal_type.h
Tile::m5
byte m5
General purpose.
Definition: map_type.h:24
SignalVariant
SignalVariant
Variant of the signal, i.e.
Definition: signal_type.h:16
SIGTYPE_PBS_ONEWAY
@ SIGTYPE_PBS_ONEWAY
no-entry signal
Definition: signal_type.h:29
RAIL_GROUND_FENCE_HORIZ1
@ RAIL_GROUND_FENCE_HORIZ1
Grass with a fence at the southern side.
Definition: rail_map.h:496
SIGTYPE_ENTRY
@ SIGTYPE_ENTRY
presignal block entry
Definition: signal_type.h:25
GetSignalStates
static uint GetSignalStates(TileIndex tile)
Set the states of the signals (Along/AgainstTrackDir)
Definition: rail_map.h:362
IsPlainRail
static bool IsPlainRail(TileIndex t)
Returns whether this is plain rails, with or without signals.
Definition: rail_map.h:49
GetTileRailType
RailType GetTileRailType(TileIndex tile)
Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.
Definition: rail.cpp:155
UnreserveTrack
static void UnreserveTrack(TileIndex tile, Track t)
Lift the reservation of a specific track on a tile.
Definition: rail_map.h:244
depot_type.h
GetSignalStateByTrackdir
static SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir)
Gets the state of the signal along the given trackdir.
Definition: rail_map.h:438
GetRailType
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
Definition: rail_map.h:115
SetPresentSignals
static void SetPresentSignals(TileIndex tile, uint signals)
Set whether the given signals are present (Along/AgainstTrackDir)
Definition: rail_map.h:383
RAIL_TILE_NORMAL
@ RAIL_TILE_NORMAL
Normal rail tile without signals.
Definition: rail_map.h:24
signal_func.h
RAIL_GROUND_FENCE_NE
@ RAIL_GROUND_FENCE_NE
Grass with a fence at the NE edge.
Definition: rail_map.h:491
track_func.h
GetRailDepotTrack
static Track GetRailDepotTrack(TileIndex t)
Returns the track of a depot, ignoring direction.
Definition: rail_map.h:182
rail_type.h
SignalOnTrack
static byte SignalOnTrack(Track track)
Maps a Track to the bits that store the status of the two signals that can be present on the given tr...
Definition: signal_func.h:42
TrackBits
TrackBits
Bitfield corresponding to Track.
Definition: track_type.h:38
IsPlainRailTile
static bool IsPlainRailTile(TileIndex t)
Checks whether the tile is a rail tile or rail tile with signals.
Definition: rail_map.h:60
TileExtended::m7
byte m7
Primarily used for newgrf support.
Definition: map_type.h:35
ReverseTrackdir
static Trackdir ReverseTrackdir(Trackdir trackdir)
Maps a trackdir to the reverse trackdir.
Definition: track_func.h:255
SetTileOwner
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
Definition: tile_map.h:198
RAIL_GROUND_FENCE_HORIZ2
@ RAIL_GROUND_FENCE_HORIZ2
Grass with a fence at the northern side.
Definition: rail_map.h:497
Trackdir
Trackdir
Enumeration for tracks and directions.
Definition: track_type.h:70
RAIL_TILE_DEPOT
@ RAIL_TILE_DEPOT
Depot (one entrance)
Definition: rail_map.h:26
Tile::m3
byte m3
General purpose.
Definition: map_type.h:22
Track
Track
These are used to specify a single track.
Definition: track_type.h:19
RailTileType
RailTileType
Different types of Rail-related tiles.
Definition: rail_map.h:23
HasTrack
static bool HasTrack(TileIndex tile, Track track)
Returns whether the given track is present on the given tile.
Definition: rail_map.h:160
TileExtended::m8
uint16 m8
General purpose.
Definition: map_type.h:36
TryReserveTrack
static bool TryReserveTrack(TileIndex tile, Track t)
Try to reserve a specific track on a tile.
Definition: rail_map.h:226
IsValidTrackdir
static bool IsValidTrackdir(Trackdir trackdir)
Checks if a Trackdir is valid for non-road vehicles.
Definition: track_func.h:60
SetRailType
static void SetRailType(TileIndex t, RailType r)
Sets the rail type of the given tile.
Definition: rail_map.h:125
Tile::m4
byte m4
General purpose.
Definition: map_type.h:23
RAIL_GROUND_ICE_DESERT
@ RAIL_GROUND_ICE_DESERT
Icy or sandy.
Definition: rail_map.h:498
_m
Tile * _m
Tiles of the map.
Definition: map.cpp:30
SignalAlongTrackdir
static byte SignalAlongTrackdir(Trackdir trackdir)
Maps a trackdir to the bit that stores its status in the map arrays, in the direction along with the ...
Definition: signal_func.h:22
RAIL_GROUND_FENCE_SW
@ RAIL_GROUND_FENCE_SW
Grass with a fence at the SW edge.
Definition: rail_map.h:492
TrackdirToTrack
static Track TrackdirToTrack(Trackdir trackdir)
Returns the Track that a given Trackdir represents.
Definition: track_func.h:270
INVALID_TRACK
@ INVALID_TRACK
Flag for an invalid track.
Definition: track_type.h:28
RAIL_GROUND_FENCE_NESW
@ RAIL_GROUND_FENCE_NESW
Grass with a fence at the NE and SW edges.
Definition: rail_map.h:493