ai/default/default.c
changeset 5385 3868f2e6db9b
parent 5247 1f982de55b88
child 5387 843c3d90823e
equal deleted inserted replaced
5384:10b6d955e1ac 5385:3868f2e6db9b
  2181 			// Clear the tunnel and continue at the other side of it.
  2181 			// Clear the tunnel and continue at the other side of it.
  2182 			if (CmdFailed(DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR)))
  2182 			if (CmdFailed(DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR)))
  2183 				return false;
  2183 				return false;
  2184 			p->ai.cur_tile_a = TILE_MASK(_build_tunnel_endtile - TileOffsByDiagDir(p->ai.cur_dir_a));
  2184 			p->ai.cur_tile_a = TILE_MASK(_build_tunnel_endtile - TileOffsByDiagDir(p->ai.cur_dir_a));
  2185 			return true;
  2185 			return true;
  2186 		}
  2186 		} else {
  2187 
       
  2188 		if (IsBridgeRamp(tile)) {
       
  2189 			// Check if the bridge points in the right direction.
  2187 			// Check if the bridge points in the right direction.
  2190 			// This is not really needed the first place AiRemoveTileAndGoForward is called.
  2188 			// This is not really needed the first place AiRemoveTileAndGoForward is called.
  2191 			if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1U)) return false;
  2189 			if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1U)) return false;
  2192 
  2190 
  2193 			tile = GetOtherBridgeEnd(tile);
  2191 			tile = GetOtherBridgeEnd(tile);
  3702 				CMD_REMOVE_ROAD);
  3700 				CMD_REMOVE_ROAD);
  3703 		}
  3701 		}
  3704 	} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  3702 	} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  3705 		if (!IsTileOwner(tile, _current_player) ||
  3703 		if (!IsTileOwner(tile, _current_player) ||
  3706 				!IsBridge(tile) ||
  3704 				!IsBridge(tile) ||
  3707 				!IsBridgeRamp(tile) ||
       
  3708 				GetBridgeTransportType(tile) != TRANSPORT_RAIL) {
  3705 				GetBridgeTransportType(tile) != TRANSPORT_RAIL) {
  3709 			return;
  3706 			return;
  3710 		}
  3707 		}
  3711 
  3708 
  3712 		rails = 0;
  3709 		rails = 0;