(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead

This commit is contained in:
smatz
2008-01-23 22:34:04 +00:00
parent dbd4d7d6a8
commit 74af65e556
19 changed files with 90 additions and 98 deletions

View File

@@ -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)