MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / CmdRemoveRoadStop

Function CmdRemoveRoadStop

src/station_cmd.cpp:2483–2496  ·  view source on GitHub ↗

* Remove bus or truck stops. * @param flags Operation to perform. * @param tile Northernmost tile of the removal area. * @param width Width of the removal area. * @param height Height of the removal area. * @param stop_type Type of stop (bus/truck). * @param remove_road Remove roads of drive-through stops? * @return The cost of this operation or an error. */

Source from the content-addressed store, hash-verified

2481 * @return The cost of this operation or an error.
2482 */
2483CommandCost CmdRemoveRoadStop(DoCommandFlags flags, TileIndex tile, uint8_t width, uint8_t height, RoadStopType stop_type, bool remove_road)
2484{
2485 if (stop_type >= RoadStopType::End) return CMD_ERROR;
2486 /* Check for incorrect width / height. */
2487 if (width == 0 || height == 0) return CMD_ERROR;
2488 /* Check if the first tile and the last tile are valid */
2489 if (!IsValidTile(tile) || TileAddWrap(tile, width - 1, height - 1) == INVALID_TILE) return CMD_ERROR;
2490 /* Bankrupting company is not supposed to remove roads, there may be road vehicles. */
2491 if (remove_road && flags.Test(DoCommandFlag::Bankrupt)) return CMD_ERROR;
2492
2493 TileArea roadstop_area(tile, width, height);
2494
2495 return RemoveGenericRoadStop(flags, roadstop_area, false, remove_road);
2496}
2497
2498/**
2499 * Remove road waypoints.

Callers

nothing calls this directly

Calls 4

IsValidTileFunction · 0.85
TileAddWrapFunction · 0.85
RemoveGenericRoadStopFunction · 0.85
TestMethod · 0.80

Tested by

no test coverage detected