diff options
author | frosch <frosch@openttd.org> | 2008-02-28 17:34:34 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-02-28 17:34:34 +0000 |
commit | 35fd0dfd4ef6ddf466599404f1e3e81a7cf855ef (patch) | |
tree | b6a5956820cbae3751e4b56fd28c9a38cd3cad1d /src/track_func.h | |
parent | 86a4d377b1f0a2cdc540ce8f029151d799a35023 (diff) | |
download | openttd-35fd0dfd4ef6ddf466599404f1e3e81a7cf855ef.tar.xz |
(svn r12313) -Fix: YAPF and NTP did not apply penalty for uphill tracks on steep slopes.
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 */ |