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/yapf | |
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/yapf')
-rw-r--r-- | src/yapf/yapf_common.cpp | 31 | ||||
-rw-r--r-- | src/yapf/yapf_costbase.hpp | 6 |
2 files changed, 2 insertions, 35 deletions
diff --git a/src/yapf/yapf_common.cpp b/src/yapf/yapf_common.cpp deleted file mode 100644 index 31e3a7b2e..000000000 --- a/src/yapf/yapf_common.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* $Id$ */ - -/** @file yapf_common.cpp */ - -#include "../stdafx.h" - -#include "yapf.hpp" -#include "follow_track.hpp" -#include "yapf_node_rail.hpp" -#include "yapf_costbase.hpp" -#include "yapf_costcache.hpp" - -/** translate tileh to the bitset of up-hill trackdirs */ -const TrackdirBits CYapfCostBase::c_upwards_slopes[] = { - TRACKDIR_BIT_NONE , ///< no tileh - TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW, ///< 1 - TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_SE, ///< 2 - TRACKDIR_BIT_X_SW , ///< 3 - TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE, ///< 4 - TRACKDIR_BIT_NONE , ///< 5 - TRACKDIR_BIT_Y_SE , ///< 6 - TRACKDIR_BIT_NONE , ///< 7 - TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_NW, ///< 8 - TRACKDIR_BIT_Y_NW , ///< 9 - TRACKDIR_BIT_NONE , ///< 10 - TRACKDIR_BIT_NONE , ///< 11 - TRACKDIR_BIT_X_NE , ///< 12 - TRACKDIR_BIT_NONE , ///< 13 - TRACKDIR_BIT_NONE , ///< 14 - TRACKDIR_BIT_NONE , ///< 15 -}; diff --git a/src/yapf/yapf_costbase.hpp b/src/yapf/yapf_costbase.hpp index 010c53ce1..6aef7fbd0 100644 --- a/src/yapf/yapf_costbase.hpp +++ b/src/yapf/yapf_costbase.hpp @@ -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; |