* Clear a single tile of a station. * @param tile The tile to clear. * @param flags The DoCommand flags related to the "command". * @return The cost, or error of clearing. */
| 4902 | * @return The cost, or error of clearing. |
| 4903 | */ |
| 4904 | CommandCost ClearTile_Station(TileIndex tile, DoCommandFlags flags) |
| 4905 | { |
| 4906 | if (flags.Test(DoCommandFlag::Auto)) { |
| 4907 | switch (GetStationType(tile)) { |
| 4908 | default: break; |
| 4909 | case StationType::Rail: return CommandCost(STR_ERROR_MUST_DEMOLISH_RAILROAD); |
| 4910 | case StationType::RailWaypoint: return CommandCost(STR_ERROR_BUILDING_MUST_BE_DEMOLISHED); |
| 4911 | case StationType::Airport: return CommandCost(STR_ERROR_MUST_DEMOLISH_AIRPORT_FIRST); |
| 4912 | case StationType::Truck: return CommandCost(HasTileRoadType(tile, RTT_TRAM) ? STR_ERROR_MUST_DEMOLISH_CARGO_TRAM_STATION_FIRST : STR_ERROR_MUST_DEMOLISH_TRUCK_STATION_FIRST); |
| 4913 | case StationType::Bus: return CommandCost(HasTileRoadType(tile, RTT_TRAM) ? STR_ERROR_MUST_DEMOLISH_PASSENGER_TRAM_STATION_FIRST : STR_ERROR_MUST_DEMOLISH_BUS_STATION_FIRST); |
| 4914 | case StationType::RoadWaypoint: return CommandCost(STR_ERROR_BUILDING_MUST_BE_DEMOLISHED); |
| 4915 | case StationType::Buoy: return CommandCost(STR_ERROR_BUOY_IN_THE_WAY); |
| 4916 | case StationType::Dock: return CommandCost(STR_ERROR_MUST_DEMOLISH_DOCK_FIRST); |
| 4917 | case StationType::Oilrig: |
| 4918 | return CommandCostWithParam(STR_ERROR_GENERIC_OBJECT_IN_THE_WAY, STR_INDUSTRY_NAME_OIL_RIG); |
| 4919 | } |
| 4920 | } |
| 4921 | |
| 4922 | switch (GetStationType(tile)) { |
| 4923 | case StationType::Rail: return RemoveRailStation(tile, flags); |
| 4924 | case StationType::RailWaypoint: return RemoveRailWaypoint(tile, flags); |
| 4925 | case StationType::Airport: return RemoveAirport(tile, flags); |
| 4926 | case StationType::Truck: [[fallthrough]]; |
| 4927 | case StationType::Bus: |
| 4928 | if (IsDriveThroughStopTile(tile)) { |
| 4929 | CommandCost remove_road = CanRemoveRoadWithStop(tile, flags); |
| 4930 | if (remove_road.Failed()) return remove_road; |
| 4931 | } |
| 4932 | return RemoveRoadStop(tile, flags); |
| 4933 | case StationType::RoadWaypoint: { |
| 4934 | CommandCost remove_road = CanRemoveRoadWithStop(tile, flags); |
| 4935 | if (remove_road.Failed()) return remove_road; |
| 4936 | return RemoveRoadWaypointStop(tile, flags); |
| 4937 | } |
| 4938 | case StationType::Buoy: return RemoveBuoy(tile, flags); |
| 4939 | case StationType::Dock: return RemoveDock(tile, flags); |
| 4940 | default: break; |
| 4941 | } |
| 4942 | |
| 4943 | return CMD_ERROR; |
| 4944 | } |
| 4945 | |
| 4946 | static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlags flags, int z_new, Slope tileh_new) |
| 4947 | { |
no test coverage detected