OpenTTD Source: src/station_cmd.h File Reference

OpenTTD Source 13.2.1

Functions
station_cmd.h File Reference
`#include "command_type.h"`
`#include "station_type.h"`

Go to the source code of this file.

## Functions
enum StationClassID byte CommandCost | CmdBuildAirport (DoCommandFlag flags, TileIndex tile, byte airport_type, byte layout, StationID station_to_join, bool allow_adjacent)
| Place an Airport. More...
CommandCost | CmdBuildDock (DoCommandFlag flags, TileIndex tile, StationID station_to_join, bool adjacent)
| Build a dock/haven. More...
CommandCost | CmdBuildRailStation (DoCommandFlag flags, TileIndex tile_org, RailType rt, Axis axis, byte numtracks, byte plat_len, StationClassID spec_class, byte spec_index, StationID station_to_join, bool adjacent)
| Build rail station. More...
CommandCost | CmdRemoveFromRailStation (DoCommandFlag flags, TileIndex start, TileIndex end, bool keep_rail)
| Remove a single tile from a rail station. More...
CommandCost | CmdBuildRoadStop (DoCommandFlag flags, TileIndex tile, uint8 width, uint8 length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, StationID station_to_join, bool adjacent)
| Build a bus or truck stop. More...
CommandCost | CmdRemoveRoadStop (DoCommandFlag flags, TileIndex tile, uint8 width, uint8 height, RoadStopType stop_type, bool remove_road)
| Remove bus or truck stops. More...
CommandCost | CmdRenameStation (DoCommandFlag flags, StationID station_id, const std::string &text)
| Rename a station. More...
CommandCost | CmdOpenCloseAirport (DoCommandFlag flags, StationID station_id)
| Open/close an airport to incoming aircraft. More...

## Detailed Description

Command definitions related to stations.

Definition in file station_cmd.h.

## Function Documentation

## ◆ CmdBuildAirport()

enum StationClassID byte CommandCost CmdBuildAirport | ( | DoCommandFlag | flags,
|  | TileIndex | tile,
|  | byte | airport_type,
|  | byte | layout,
|  | StationID | station_to_join,
|  | bool | allow_adjacent
| ) |  |

Place an Airport.

Parameters

  flags | operation to perform
  tile | tile where airport will be built
  airport_type | airport type,

See also
  airport.h

Parameters

  layout | airport layout
  station_to_join | station ID to join (NEW_STATION if build new one)
  allow_adjacent | allow airports directly adjacent to other airports.

Returns
  the cost of this operation or an error

Definition at line 2211 of file station_cmd.cpp.

## ◆ CmdBuildDock()

CommandCost CmdBuildDock | ( | DoCommandFlag | flags,
|  | TileIndex | tile,
|  | StationID | station_to_join,
|  | bool | adjacent
| ) |  |

Build a dock/haven.

Parameters

  flags | operation to perform
  tile | tile where dock will be built
  station_to_join | station ID to join (NEW_STATION if build new one)
  adjacent | allow docks directly adjacent to other docks.

Returns
  the cost of this operation or an error

Definition at line 2476 of file station_cmd.cpp.

## ◆ CmdBuildRailStation()

CommandCost CmdBuildRailStation | ( | DoCommandFlag | flags,
|  | TileIndex | tile_org,
|  | RailType | rt,
|  | Axis | axis,
|  | byte | numtracks,
|  | byte | plat_len,
|  | StationClassID | spec_class,
|  | byte | spec_index,
|  | StationID | station_to_join,
|  | bool | adjacent
| ) |  |

Build rail station.

Parameters

  flags | operation to perform
  tile_org | northern most position of station dragging/placement
  rt | railtype
  axis | orientation (Axis)
  numtracks | number of tracks
  plat_len | platform length
  spec_class | custom station class
  spec_index | custom station id
  station_to_join | station ID to join (NEW_STATION if build new one)
  adjacent | allow stations directly adjacent to other stations.

Returns
  the cost of this operation or an error

Definition at line 1260 of file station_cmd.cpp.

References AXIS_X, CheckIfAuthorityAllowsNewStation(), CMD_ERROR, CommandCost::Failed(), NewGRFClass< Tspec, Tid, Tmax >::Get(), IsValidAxis(), STAT_CLASS_WAYP, and ValParamRailtype().

## ◆ CmdBuildRoadStop()

CommandCost CmdBuildRoadStop | ( | DoCommandFlag | flags,
|  | TileIndex | tile,
|  | uint8 | width,
|  | uint8 | length,
|  | RoadStopType | stop_type,
|  | bool | is_drive_through,
|  | DiagDirection | ddir,
|  | RoadType | rt,
|  | StationID | station_to_join,
|  | bool | adjacent
| ) |  |

Build a bus or truck stop.

Parameters

  flags | Operation to perform.
  tile | Northernmost tile of the stop.
  width | Width of the road stop.
  length | Length of the road stop.
  stop_type | Type of road stop (bus/truck).
  is_drive_through | False for normal stops, true for drive-through.
  ddir | Entrance direction (DiagDirection) for normal stops. Converted to the axis for drive-through stops.
  rt | The roadtype.
  station_to_join | Station ID to join (NEW_STATION if build new one).
  adjacent | Allow stations directly adjacent to other stations.

Returns
  The cost of this operation or an error.

Definition at line 1827 of file station_cmd.cpp.

References CMD_ERROR, IsValidDiagDirection(), ROADSTOP_END, and ValParamRoadType().

## ◆ CmdOpenCloseAirport()

CommandCost CmdOpenCloseAirport | ( | DoCommandFlag | flags,
|  | StationID | station_id
| ) |  |

Open/close an airport to incoming aircraft.

Parameters

  flags | Operation to perform.
  station_id | Station ID of the airport.

Returns
  the cost of this operation or an error

Definition at line 2422 of file station_cmd.cpp.

References Station::airport, AIRPORT_CLOSED_block, CheckOwnership(), CMD_ERROR, DC_EXEC, FACIL_AIRPORT, BaseStation::facilities, CommandCost::Failed(), Airport::flags, SpecializedStation< Station, false >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, SpecializedStation< Station, false >::IsValidID(), BaseStation::owner, OWNER_NONE, SetWindowWidgetDirty(), WC_STATION_VIEW, and WID_SV_CLOSE_AIRPORT.

## ◆ CmdRemoveFromRailStation()

CommandCost CmdRemoveFromRailStation | ( | DoCommandFlag | flags,
|  | TileIndex | start,
|  | TileIndex | end,
|  | bool | keep_rail
| ) |  |

Remove a single tile from a rail station.

This allows for custom-built station with holes and weird layouts

Parameters

  flags | operation to perform
  start | tile of station piece to remove
  end | other edge of the rect to remove
  keep_rail | if set keep the rail

Returns
  the cost of this operation or an error

Definition at line 1657 of file station_cmd.cpp.

References CMD_ERROR, MapSize(), and RemoveFromRailBaseStation().

## ◆ CmdRemoveRoadStop()

CommandCost CmdRemoveRoadStop | ( | DoCommandFlag | flags,
|  | TileIndex | tile,
|  | uint8 | width,
|  | uint8 | height,
|  | RoadStopType | stop_type,
|  | bool | remove_road
| ) |  |

Remove bus or truck stops.

Parameters

  flags | Operation to perform.
  tile | Northernmost tile of the removal area.
  width | Width of the removal area.
  height | Height of the removal area.
  stop_type | Type of stop (bus/truck).
  remove_road | Remove roads of drive-through stops?

Returns
  The cost of this operation or an error.

Definition at line 2058 of file station_cmd.cpp.

References CMD_ERROR, DC_BANKRUPT, EXPENSES_CONSTRUCTION, GetRoadStopType(), INVALID_ROADTYPE, INVALID_TILE, IsDriveThroughStopTile(), IsRoadStop(), IsTileType(), IsValidTile(), MP_STATION, OWNER_NONE, ROAD_NONE, ROADSTOP_END, and TileAddWrap().

## ◆ CmdRenameStation()

CommandCost CmdRenameStation | ( | DoCommandFlag | flags,
|  | StationID | station_id,
|  | const std::string & | text
| ) |  |

Rename a station.

Parameters

  flags | operation to perform
  station_id | station ID that is to be renamed
  text | the new name or an empty string when resetting to the default

Returns
  the cost of this operation or an error

Definition at line 3897 of file station_cmd.cpp.

References CheckOwnership(), CMD_ERROR, CommandCost::Failed(), SpecializedStation< Station, false >::GetIfValid(), MAX_LENGTH_STATION_NAME_CHARS, BaseStation::owner, and Utf8StringLength().