340 // Next, check for tunnels! |
340 // Next, check for tunnels! |
341 // Tunnels can only be built on slopes corresponding to the direction |
341 // Tunnels can only be built on slopes corresponding to the direction |
342 // For now, we check both sides for this tile.. terraforming gives fuzzy result |
342 // For now, we check both sides for this tile.. terraforming gives fuzzy result |
343 if (tileh == InclinedSlope(dir)) { |
343 if (tileh == InclinedSlope(dir)) { |
344 // Now simply check if a tunnel can be build |
344 // Now simply check if a tunnel can be build |
345 ret = AI_DoCommand(tile, (PathFinderInfo->rail_or_road?0:0x200), 0, DC_AUTO, CMD_BUILD_TUNNEL); |
345 ret = AI_DoCommand(tile, (PathFinderInfo->rail_or_road ? 0 : 0x200), 0, DC_AUTO, CMD_BUILD_TUNNEL); |
346 tileh = GetTileSlope(_build_tunnel_endtile, NULL); |
346 tileh = GetTileSlope(_build_tunnel_endtile, NULL); |
347 if (CmdSucceeded(ret) && IsInclinedSlope(tileh)) { |
347 if (CmdSucceeded(ret) && IsInclinedSlope(tileh)) { |
348 aystar->neighbours[aystar->num_neighbours].tile = _build_tunnel_endtile; |
348 aystar->neighbours[aystar->num_neighbours].tile = _build_tunnel_endtile; |
349 aystar->neighbours[aystar->num_neighbours].user_data[0] = AI_PATHFINDER_FLAG_TUNNEL + (dir << 8); |
349 aystar->neighbours[aystar->num_neighbours].user_data[0] = AI_PATHFINDER_FLAG_TUNNEL + (dir << 8); |
350 aystar->neighbours[aystar->num_neighbours++].direction = 0; |
350 aystar->neighbours[aystar->num_neighbours++].direction = 0; |