diff options
author | smatz <smatz@openttd.org> | 2008-01-23 22:34:04 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-01-23 22:34:04 +0000 |
commit | 5a7c9037709772e4678ee57d9b42f5332bd66f97 (patch) | |
tree | ae76a3390a465cf3bfc011e2b32d53d5ae55c298 /src/npf.cpp | |
parent | b5641ae0f2ca3723af7fe7f68c4ac45e113e8421 (diff) | |
download | openttd-5a7c9037709772e4678ee57d9b42f5332bd66f97.tar.xz |
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
Diffstat (limited to 'src/npf.cpp')
-rw-r--r-- | src/npf.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/npf.cpp b/src/npf.cpp index 31e791674..582413c63 100644 --- a/src/npf.cpp +++ b/src/npf.cpp @@ -22,6 +22,7 @@ #include "functions.h" #include "vehicle_base.h" #include "settings_type.h" +#include "tunnelbridge.h" static AyStar _npf_aystar; @@ -176,9 +177,7 @@ static uint NPFTunnelCost(AyStarNode* current) if (GetTunnelBridgeDirection(tile) == ReverseDiagDir(exitdir)) { /* We just popped out if this tunnel, since were * facing the tunnel exit */ - FindLengthOfTunnelResult flotr; - flotr = FindLengthOfTunnel(tile, ReverseDiagDir(exitdir)); - return flotr.length * NPF_TILE_LENGTH; + return NPF_TILE_LENGTH * (GetTunnelBridgeLength(current->tile, GetOtherTunnelEnd(current->tile)) + 1); /* @todo: Penalty for tunnels? */ } else { /* We are entering the tunnel, the enter tile is just a @@ -189,7 +188,7 @@ static uint NPFTunnelCost(AyStarNode* current) static inline uint NPFBridgeCost(AyStarNode *current) { - return NPF_TILE_LENGTH * GetBridgeLength(current->tile, GetOtherBridgeEnd(current->tile)); + return NPF_TILE_LENGTH * GetTunnelBridgeLength(current->tile, GetOtherBridgeEnd(current->tile)); } static uint NPFSlopeCost(AyStarNode* current) |