@ -153,21 +153,21 @@ static inline bool IsValidTrackdir(Trackdir trackdir) { return trackdir < TRACKD
* Maps a trackdir to the bit that stores its status in the map arrays , in the
* Maps a trackdir to the bit that stores its status in the map arrays , in the
* direction along with the trackdir .
* direction along with the trackdir .
*/
*/
const byte _signal_along_trackdir [ TRACKDIR_END ] ;
extern const byte _signal_along_trackdir [ TRACKDIR_END ] ;
static inline byte SignalAlongTrackdir ( Trackdir trackdir ) { return _signal_along_trackdir [ trackdir ] ; }
static inline byte SignalAlongTrackdir ( Trackdir trackdir ) { return _signal_along_trackdir [ trackdir ] ; }
/**
/**
* Maps a trackdir to the bit that stores its status in the map arrays , in the
* Maps a trackdir to the bit that stores its status in the map arrays , in the
* direction against the trackdir .
* direction against the trackdir .
*/
*/
const byte _signal_against_trackdir [ TRACKDIR_END ] ;
extern const byte _signal_against_trackdir [ TRACKDIR_END ] ;
static inline byte SignalAgainstTrackdir ( Trackdir trackdir ) { return _signal_against_trackdir [ trackdir ] ; }
static inline byte SignalAgainstTrackdir ( Trackdir trackdir ) { return _signal_against_trackdir [ trackdir ] ; }
/**
/**
* Maps a Track to the bits that store the status of the two signals that can
* Maps a Track to the bits that store the status of the two signals that can
* be present on the given track .
* be present on the given track .
*/
*/
const byte _signal_on_track [ TRACK_END ] ;
extern const byte _signal_on_track [ TRACK_END ] ;
static inline byte SignalOnTrack ( Track track ) { return _signal_on_track [ track ] ; }
static inline byte SignalOnTrack ( Track track ) { return _signal_on_track [ track ] ; }
/*
/*
@ -247,7 +247,7 @@ static inline bool HasTrack(TileIndex tile, Track track)
/**
/**
* Maps a trackdir to the reverse trackdir .
* Maps a trackdir to the reverse trackdir .
*/
*/
const Trackdir _reverse_trackdir [ TRACKDIR_END ] ;
extern const Trackdir _reverse_trackdir [ TRACKDIR_END ] ;
static inline Trackdir ReverseTrackdir ( Trackdir trackdir ) { return _reverse_trackdir [ trackdir ] ; }
static inline Trackdir ReverseTrackdir ( Trackdir trackdir ) { return _reverse_trackdir [ trackdir ] ; }
/**
/**
@ -280,48 +280,48 @@ static inline TrackdirBits TrackToTrackdirBits(Track track) { Trackdir td = Trac
* ahead . This will be the same trackdir for diagonal trackdirs , but a
* ahead . This will be the same trackdir for diagonal trackdirs , but a
* different ( alternating ) one for straight trackdirs
* different ( alternating ) one for straight trackdirs
*/
*/
const Trackdir _next_trackdir [ TRACKDIR_END ] ;
extern const Trackdir _next_trackdir [ TRACKDIR_END ] ;
static inline Trackdir NextTrackdir ( Trackdir trackdir ) { return _next_trackdir [ trackdir ] ; }
static inline Trackdir NextTrackdir ( Trackdir trackdir ) { return _next_trackdir [ trackdir ] ; }
/**
/**
* Maps a track to all tracks that make 90 deg turns with it .
* Maps a track to all tracks that make 90 deg turns with it .
*/
*/
const TrackBits _track_crosses_tracks [ TRACK_END ] ;
extern const TrackBits _track_crosses_tracks [ TRACK_END ] ;
static inline TrackBits TrackCrossesTracks ( Track track ) { return _track_crosses_tracks [ track ] ; }
static inline TrackBits TrackCrossesTracks ( Track track ) { return _track_crosses_tracks [ track ] ; }
/**
/**
* Maps a trackdir to the ( 4 - way ) direction the tile is exited when following
* Maps a trackdir to the ( 4 - way ) direction the tile is exited when following
* that trackdir .
* that trackdir .
*/
*/
const DiagDirection _trackdir_to_exitdir [ TRACKDIR_END ] ;
extern const DiagDirection _trackdir_to_exitdir [ TRACKDIR_END ] ;
static inline DiagDirection TrackdirToExitdir ( Trackdir trackdir ) { return _trackdir_to_exitdir [ trackdir ] ; }
static inline DiagDirection TrackdirToExitdir ( Trackdir trackdir ) { return _trackdir_to_exitdir [ trackdir ] ; }
/**
/**
* Maps a track and an ( 4 - way ) dir to the trackdir that represents the track
* Maps a track and an ( 4 - way ) dir to the trackdir that represents the track
* with the exit in the given direction .
* with the exit in the given direction .
*/
*/
const Trackdir _track_exitdir_to_trackdir [ TRACK_END ] [ DIAGDIR_END ] ;
extern const Trackdir _track_exitdir_to_trackdir [ TRACK_END ] [ DIAGDIR_END ] ;
static inline Trackdir TrackExitdirToTrackdir ( Track track , DiagDirection diagdir ) { return _track_exitdir_to_trackdir [ track ] [ diagdir ] ; }
static inline Trackdir TrackExitdirToTrackdir ( Track track , DiagDirection diagdir ) { return _track_exitdir_to_trackdir [ track ] [ diagdir ] ; }
/**
/**
* Maps a track and a full ( 8 - way ) direction to the trackdir that represents
* Maps a track and a full ( 8 - way ) direction to the trackdir that represents
* the track running in the given direction .
* the track running in the given direction .
*/
*/
const Trackdir _track_direction_to_trackdir [ TRACK_END ] [ DIR_END ] ;
extern const Trackdir _track_direction_to_trackdir [ TRACK_END ] [ DIR_END ] ;
static inline Trackdir TrackDirectionToTrackdir ( Track track , Direction dir ) { return _track_direction_to_trackdir [ track ] [ dir ] ; }
static inline Trackdir TrackDirectionToTrackdir ( Track track , Direction dir ) { return _track_direction_to_trackdir [ track ] [ dir ] ; }
/**
/**
* Maps a ( 4 - way ) direction to the diagonal trackdir that runs in that
* Maps a ( 4 - way ) direction to the diagonal trackdir that runs in that
* direction .
* direction .
*/
*/
const Trackdir _dir_to_diag_trackdir [ DIAGDIR_END ] ;
extern const Trackdir _dir_to_diag_trackdir [ DIAGDIR_END ] ;
static inline Trackdir DiagdirToDiagTrackdir ( DiagDirection diagdir ) { return _dir_to_diag_trackdir [ diagdir ] ; }
static inline Trackdir DiagdirToDiagTrackdir ( DiagDirection diagdir ) { return _dir_to_diag_trackdir [ diagdir ] ; }
/**
/**
* Maps a trackdir to the trackdirs that can be reached from it ( ie , when
* Maps a trackdir to the trackdirs that can be reached from it ( ie , when
* entering the next tile . This
* entering the next tile . This
*/
*/
const TrackdirBits _exitdir_reaches_trackdirs [ DIAGDIR_END ] ;
extern const TrackdirBits _exitdir_reaches_trackdirs [ DIAGDIR_END ] ;
/* Note that there is no direct table for this function (there used to be),
/* Note that there is no direct table for this function (there used to be),
* but it uses two simpeler tables to achieve the result */
* but it uses two simpeler tables to achieve the result */
static inline TrackdirBits TrackdirReachesTrackdirs ( Trackdir trackdir ) { return _exitdir_reaches_trackdirs [ TrackdirToExitdir ( trackdir ) ] ; }
static inline TrackdirBits TrackdirReachesTrackdirs ( Trackdir trackdir ) { return _exitdir_reaches_trackdirs [ TrackdirToExitdir ( trackdir ) ] ; }
@ -329,13 +329,13 @@ static inline TrackdirBits TrackdirReachesTrackdirs(Trackdir trackdir) { return
/**
/**
* Maps a trackdir to all trackdirs that make 90 deg turns with it .
* Maps a trackdir to all trackdirs that make 90 deg turns with it .
*/
*/
const TrackdirBits _track_crosses_trackdirs [ TRACKDIR_END ] ;
extern const TrackdirBits _track_crosses_trackdirs [ TRACKDIR_END ] ;
static inline TrackdirBits TrackdirCrossesTrackdirs ( Trackdir trackdir ) { return _track_crosses_trackdirs [ TrackdirToTrack ( trackdir ) ] ; }
static inline TrackdirBits TrackdirCrossesTrackdirs ( Trackdir trackdir ) { return _track_crosses_trackdirs [ TrackdirToTrack ( trackdir ) ] ; }
/**
/**
* Maps a ( 4 - way ) direction to the reverse .
* Maps a ( 4 - way ) direction to the reverse .
*/
*/
const DiagDirection _reverse_diagdir [ DIAGDIR_END ] ;
extern const DiagDirection _reverse_diagdir [ DIAGDIR_END ] ;
static inline DiagDirection ReverseDiagdir ( DiagDirection diagdir ) { return _reverse_diagdir [ diagdir ] ; }
static inline DiagDirection ReverseDiagdir ( DiagDirection diagdir ) { return _reverse_diagdir [ diagdir ] ; }
/* Checks if a given Track is diagonal */
/* Checks if a given Track is diagonal */