diff -r 2e4d5d55bdf0 -r 93528d9cb96d src/track_func.h --- a/src/track_func.h Wed May 14 18:27:39 2008 +0000 +++ b/src/track_func.h Wed May 14 18:31:21 2008 +0000 @@ -24,8 +24,6 @@ return (Track)a; } - - /** * Maps a Track to the corresponding TrackBits value * @param track the track to convert @@ -277,7 +275,7 @@ * Converts TrackBits to TrackdirBits while allowing both directions. * * @param bits The TrackBits - * @return The TrackDirBits containing of bits in both directions. + * @return The TrackdirBits containing of bits in both directions. */ static inline TrackdirBits TrackBitsToTrackdirBits(TrackBits bits) { @@ -436,13 +434,35 @@ } /** + * Maps a (4-way) direction to the diagonal track incidating with that diagdir + * + * @param diagdir The direction + * @return The resulting Track + */ +static inline Track DiagDirToDiagTrack(DiagDirection diagdir) +{ + return (Track)(diagdir & 1); +} + +/** + * Maps a (4-way) direction to the diagonal track bits incidating with that diagdir + * + * @param diagdir The direction + * @return The resulting TrackBits + */ +static inline TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir) +{ + return TrackToTrackBits(DiagDirToDiagTrack(diagdir)); +} + +/** * Maps a (4-way) direction to the diagonal trackdir that runs in that * direction. * * @param diagdir The direction * @return The resulting Trackdir direction */ -static inline Trackdir DiagdirToDiagTrackdir(DiagDirection diagdir) +static inline Trackdir DiagDirToDiagTrackdir(DiagDirection diagdir) { extern const Trackdir _dir_to_diag_trackdir[DIAGDIR_END]; return _dir_to_diag_trackdir[diagdir];