From 3cee0abdbaf6c867ca71fec4700823f545556936 Mon Sep 17 00:00:00 2001 From: smatz Date: Sun, 16 Dec 2007 15:38:51 +0000 Subject: (svn r11644) -Codechange: merge some functions from tunnel_map.h and bridge_map.h into tunnelbridge_map.h --- src/ai/default/default.cpp | 8 +++++--- src/ai/trolly/pathfinder.cpp | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/ai') diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index e84217ddc..671f6a07e 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -28,8 +28,10 @@ #include "../../bridge.h" #include "../../date.h" #include "../../helpers.hpp" +#include "../../tunnelbridge_map.h" #include "default.h" + // remove some day perhaps? static uint _ai_service_interval; @@ -2233,7 +2235,7 @@ static bool AiRemoveTileAndGoForward(Player *p) } else { // Check if the bridge points in the right direction. // This is not really needed the first place AiRemoveTileAndGoForward is called. - if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1)) return false; + if (DiagDirToAxis(GetTunnelBridgeDirection(tile)) != (p->ai.cur_dir_a & 1)) return false; tile = GetOtherBridgeEnd(tile); @@ -3733,13 +3735,13 @@ pos_3: } else if (IsTileType(tile, MP_TUNNELBRIDGE)) { if (!IsTileOwner(tile, _current_player) || !IsBridge(tile) || - GetBridgeTransportType(tile) != TRANSPORT_RAIL) { + GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) { return; } rails = TRACK_BIT_NONE; - switch (GetBridgeRampDirection(tile)) { + switch (GetTunnelBridgeDirection(tile)) { default: case DIAGDIR_NE: goto pos_2; case DIAGDIR_SE: goto pos_3; diff --git a/src/ai/trolly/pathfinder.cpp b/src/ai/trolly/pathfinder.cpp index bd243dd31..33383a560 100644 --- a/src/ai/trolly/pathfinder.cpp +++ b/src/ai/trolly/pathfinder.cpp @@ -12,8 +12,10 @@ #include "../../depot.h" #include "../../tunnel_map.h" #include "../../bridge.h" +#include "../../tunnelbridge_map.h" #include "../ai.h" + #define TEST_STATION_NO_DIR 0xFF // Tests if a station can be build on the given spot @@ -44,8 +46,8 @@ static bool IsRoad(TileIndex tile) // MP_ROAD, but not a road depot? (IsTileType(tile, MP_ROAD) && !IsTileDepotType(tile, TRANSPORT_ROAD)) || (IsTileType(tile, MP_TUNNELBRIDGE) && ( - (IsTunnel(tile) && GetTunnelTransportType(tile) == TRANSPORT_ROAD) || - (IsBridge(tile) && GetBridgeTransportType(tile) == TRANSPORT_ROAD) + (IsTunnel(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD) || + (IsBridge(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD) )); } @@ -235,9 +237,9 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr if (!PathFinderInfo->rail_or_road && IsRoad(atile)) { if (IsTileType(atile, MP_TUNNELBRIDGE)) { if (IsTunnel(atile)) { - if (GetTunnelDirection(atile) != i) continue; + if (GetTunnelBridgeDirection(atile) != i) continue; } else { - if (GetBridgeRampDirection(atile) != i) continue; + if (GetTunnelBridgeDirection(atile) != i) continue; } } } -- cgit v1.2.3-70-g09d2