diff -r 2c40faeef7a5 -r 889301acc299 src/npf.cpp --- a/src/npf.cpp Sun Feb 03 01:34:21 2008 +0000 +++ b/src/npf.cpp Sun Feb 03 20:34:26 2008 +0000 @@ -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 @@ 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 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)