diff options
Diffstat (limited to 'src/track_func.h')
-rw-r--r-- | src/track_func.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/track_func.h b/src/track_func.h index 38a1bba66..88d8d423e 100644 --- a/src/track_func.h +++ b/src/track_func.h @@ -574,4 +574,20 @@ static inline bool IsStraightRoadTrackdir(Trackdir dir) return (dir & 0x06) == 0; } +/** + * Checks whether a trackdir on a specific slope is going uphill. + * + * Valid for rail and road tracks. + * Valid for tile-slopes (under foundation) and foundation-slopes (on foundation). + * + * @param slope The slope of the tile. + * @param dir The trackdir of interest. + * @return true iff the track goes upwards. + */ +static inline bool IsUphillTrackdir(Slope slope, Trackdir dir) +{ + extern const TrackdirBits _uphill_trackdirs[]; + return HasBit(_uphill_trackdirs[RemoveHalftileSlope(slope)], dir); +} + #endif /* TRACK_FUNC_H */ |