Slope tileh_end_aqueduct = GetTileSlope(tile_end); if (tileh_end_aqueduct != ComplementSlope(tileh_start)) { switch (tileh_start) { case SLOPE_NE: switch (tileh_end_aqueduct) { case SLOPE_S: case SLOPE_STEEP_S: tileh_end_aqueduct = SLOPE_W; break; case SLOPE_W: case SLOPE_STEEP_W: tileh_end_aqueduct = SLOPE_S; break; default: NOT_REACHED(); } case SLOPE_NW: switch (tileh_end_aqueduct) { case SLOPE_E: case SLOPE_STEEP_E: tileh_end_aqueduct = SLOPE_S; break; case SLOPE_S: case SLOPE_STEEP_S: tileh_end_aqueduct = SLOPE_E; break; default: NOT_REACHED(); } case SLOPE_SW: switch (tileh_end_aqueduct) { case SLOPE_N: case SLOPE_STEEP_N: tileh_end_aqueduct = SLOPE_E; break; case SLOPE_E: case SLOPE_STEEP_E: tileh_end_aqueduct = SLOPE_N; break; default: NOT_REACHED(); } case SLOPE_SE: switch (tileh_end_aqueduct) { case SLOPE_W: case SLOPE_STEEP_W: tileh_end_aqueduct = SLOPE_N; break; case SLOPE_N: case SLOPE_STEEP_N: tileh_end_aqueduct = SLOPE_W; break; default: NOT_REACHED(); } default: NOT_REACHED(); } /* Mark the tile as already cleared for the terraform command. * Do this for all tiles (like trees), not only objects. */ ClearedObjectArea *coa = FindClearedObject(tile_end); if (coa == NULL) { coa = _cleared_object_areas.Append(); coa->first_tile = tile_end; coa->area = TileArea(tile_end, 1, 1); } /* Hide the tile from the terraforming command */ TileIndex old_first_tile = coa->first_tile; coa->first_tile = INVALID_TILE; ret = DoCommand(tile_end, tileh_end_aqueduct, 1, flags, CMD_TERRAFORM_LAND); coa->first_tile = old_first_tile; if (ret.Failed()) return_cmd_error(STR_ERROR_UNABLE_TO_EXCAVATE_LAND); cost.AddCost(ret); }