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 | 74af65e556f6cedf4de72737fb27831f603953c4 (patch) | |
tree | ae76a3390a465cf3bfc011e2b32d53d5ae55c298 /src/ai/trolly | |
parent | dbd4d7d6a8a4449cf1939752331a95c15ad276f9 (diff) | |
download | openttd-74af65e556f6cedf4de72737fb27831f603953c4.tar.xz |
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
Diffstat (limited to 'src/ai/trolly')
-rw-r--r-- | src/ai/trolly/build.cpp | 4 | ||||
-rw-r--r-- | src/ai/trolly/pathfinder.cpp | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/ai/trolly/build.cpp b/src/ai/trolly/build.cpp index 329c54d34..c6bf330e7 100644 --- a/src/ai/trolly/build.cpp +++ b/src/ai/trolly/build.cpp @@ -15,6 +15,8 @@ #include "../../player_base.h" #include "../../player_func.h" #include "../ai.h" +#include "../../tunnelbridge.h" + // Build HQ // Params: @@ -58,7 +60,7 @@ CommandCost AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, by int bridge_type, bridge_len, type, type2; // Find a good bridgetype (the best money can buy) - bridge_len = GetBridgeLength(tile_a, tile_b); + bridge_len = GetTunnelBridgeLength(tile_a, tile_b); type = type2 = 0; for (bridge_type = MAX_BRIDGES-1; bridge_type >= 0; bridge_type--) { if (CheckBridge_Stuff(bridge_type, bridge_len)) { 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; |