(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

@@ -4,8 +4,6 @@
#define YAPF_COSTBASE_HPP
struct CYapfCostBase {
static const TrackdirBits c_upwards_slopes[16];
FORCEINLINE static bool stSlopeCost(TileIndex tile, Trackdir td)
{
if (IsDiagonalTrackdir(td)) {
@@ -19,8 +17,8 @@ struct CYapfCostBase {
} else {
// not bridge ramp
if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope
uint tile_slope = GetTileSlope(tile, NULL) & 0x0F;
if ((c_upwards_slopes[tile_slope] & TrackdirToTrackdirBits(td)) != 0) return true; // slopes uphill => apply penalty
Slope tile_slope = GetTileSlope(tile, NULL);
return IsUphillTrackdir(tile_slope, td); // slopes uphill => apply penalty
}
}
return false;