summaryrefslogtreecommitdiff
path: root/src/ai/trolly/pathfinder.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-01-23 22:34:04 +0000
committersmatz <smatz@openttd.org>2008-01-23 22:34:04 +0000
commit5a7c9037709772e4678ee57d9b42f5332bd66f97 (patch)
treeae76a3390a465cf3bfc011e2b32d53d5ae55c298 /src/ai/trolly/pathfinder.cpp
parentb5641ae0f2ca3723af7fe7f68c4ac45e113e8421 (diff)
downloadopenttd-5a7c9037709772e4678ee57d9b42f5332bd66f97.tar.xz
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
Diffstat (limited to 'src/ai/trolly/pathfinder.cpp')
-rw-r--r--src/ai/trolly/pathfinder.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ai/trolly/pathfinder.cpp b/src/ai/trolly/pathfinder.cpp
index caef80147..3580f48a3 100644
--- a/src/ai/trolly/pathfinder.cpp
+++ b/src/ai/trolly/pathfinder.cpp
@@ -14,6 +14,7 @@
#include "../../variables.h"
#include "../../player_base.h"
#include "../../player_func.h"
+#include "../../tunnelbridge.h"
#define TEST_STATION_NO_DIR 0xFF
@@ -320,7 +321,7 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
new_tile += TileOffsByDiagDir(dir);
// Precheck, is the length allowed?
- if (!CheckBridge_Stuff(0, GetBridgeLength(tile, new_tile))) break;
+ if (!CheckBridge_Stuff(0, GetTunnelBridgeLength(tile, new_tile))) break;
// Check if we hit the station-tile.. we don't like that!
if (TILES_BETWEEN(new_tile, PathFinderInfo->end_tile_tl, PathFinderInfo->end_tile_br)) break;
@@ -425,14 +426,14 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
int r;
// Tunnels are very expensive when build on long routes..
// Ironicly, we are using BridgeCode here ;)
- r = AI_PATHFINDER_TUNNEL_PENALTY * GetBridgeLength(current->tile, parent->path.node.tile);
+ r = AI_PATHFINDER_TUNNEL_PENALTY * GetTunnelBridgeLength(current->tile, parent->path.node.tile);
res += r + (r >> 8);
}
// Are we part of a bridge?
if ((AI_PATHFINDER_FLAG_BRIDGE & current->user_data[0]) != 0) {
// That means for every length a penalty
- res += AI_PATHFINDER_BRIDGE_PENALTY * GetBridgeLength(current->tile, parent->path.node.tile);
+ res += AI_PATHFINDER_BRIDGE_PENALTY * GetTunnelBridgeLength(current->tile, parent->path.node.tile);
// Check if we are going up or down, first for the starting point
// In user_data[0] is at the 8th bit the direction
if (!HasBridgeFlatRamp(parent_tileh, (Axis)((current->user_data[0] >> 8) & 1))) res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;