diff options
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/default/default.cpp | 5 | ||||
-rw-r--r-- | src/ai/trolly/build.cpp | 4 | ||||
-rw-r--r-- | src/ai/trolly/pathfinder.cpp | 7 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index 2ea82bcda..49bd07fe9 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -31,6 +31,7 @@ #include "../../player_base.h" #include "../../settings_type.h" #include "default.h" +#include "../../tunnelbridge.h" #include "../../table/ai_rail.h" @@ -2173,7 +2174,7 @@ static void AiBuildRailConstruct(Player *p) if (arf.best_ptr[0] & 0x80) { int i; - int32 bridge_len = GetBridgeLength(arf.bridge_end_tile, _players_ai[p->index].cur_tile_a); + int32 bridge_len = GetTunnelBridgeLength(arf.bridge_end_tile, _players_ai[p->index].cur_tile_a); /* Figure out which (rail)bridge type to build * start with best bridge, then go down to worse and worse bridges @@ -3065,7 +3066,7 @@ do_some_terraform: int i; int32 bridge_len; _players_ai[p->index].cur_tile_a = arf.bridge_end_tile; - bridge_len = GetBridgeLength(tile, _players_ai[p->index].cur_tile_a); // tile + bridge_len = GetTunnelBridgeLength(tile, _players_ai[p->index].cur_tile_a); // tile /* Figure out what (road)bridge type to build * start with best bridge, then go down to worse and worse bridges 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; |