ai/default/default.c
changeset 3933 231ae3c419f4
parent 3876 468642825a10
child 3948 a09379beffd5
equal deleted inserted replaced
3932:dfe10fa5ce4f 3933:231ae3c419f4
  2156 			// Clear the tunnel and continue at the other side of it.
  2156 			// Clear the tunnel and continue at the other side of it.
  2157 			if (CmdFailed(DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR)))
  2157 			if (CmdFailed(DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR)))
  2158 				return false;
  2158 				return false;
  2159 			p->ai.cur_tile_a = TILE_MASK(_build_tunnel_endtile - TileOffsByDir(p->ai.cur_dir_a));
  2159 			p->ai.cur_tile_a = TILE_MASK(_build_tunnel_endtile - TileOffsByDir(p->ai.cur_dir_a));
  2160 			return true;
  2160 			return true;
  2161 		}
  2161 		} else {
  2162 
       
  2163 		if (IsBridgeRamp(tile)) {
       
  2164 			// Check if the bridge points in the right direction.
  2162 			// Check if the bridge points in the right direction.
  2165 			// This is not really needed the first place AiRemoveTileAndGoForward is called.
  2163 			// This is not really needed the first place AiRemoveTileAndGoForward is called.
  2166 			if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1U)) return false;
  2164 			if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1U)) return false;
  2167 
  2165 
  2168 			tile = GetOtherBridgeEnd(tile);
  2166 			tile = GetOtherBridgeEnd(tile);
  3690 				CMD_REMOVE_ROAD);
  3688 				CMD_REMOVE_ROAD);
  3691 		}
  3689 		}
  3692 	} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  3690 	} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  3693 		if (!IsTileOwner(tile, _current_player) ||
  3691 		if (!IsTileOwner(tile, _current_player) ||
  3694 				!IsBridge(tile) ||
  3692 				!IsBridge(tile) ||
  3695 				!IsBridgeRamp(tile) ||
       
  3696 				GetBridgeTransportType(tile) != TRANSPORT_RAIL) {
  3693 				GetBridgeTransportType(tile) != TRANSPORT_RAIL) {
  3697 			return;
  3694 			return;
  3698 		}
  3695 		}
  3699 
  3696 
  3700 		rails = 0;
  3697 		rails = 0;