(svn r12313) -Fix: YAPF and NTP did not apply penalty for uphill tracks on steep slopes.

This commit is contained in:
frosch
2008-02-28 17:34:34 +00:00
parent 86a4d377b1
commit 35fd0dfd4e
8 changed files with 54 additions and 65 deletions

View File

@@ -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 */