OpenTTD Source  20241120-master-g6d3adc6169
station_cmd.h File Reference

Command definitions related to stations. More...

#include "command_type.h"
#include "station_type.h"

Go to the source code of this file.

Functions

enum StationClassID uint16_t enum RoadStopClassID uint16_t TownAirportGetNearestTown (const struct AirportSpec *as, Direction rotation, TileIndex tile, TileIterator &&it, uint &mindist)
 
uint8_t GetAirportNoiseLevelForDistance (const struct AirportSpec *as, uint distance)
 
CommandCost CmdBuildAirport (DoCommandFlag flags, TileIndex tile, uint8_t airport_type, uint8_t 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, uint8_t numtracks, uint8_t plat_len, StationClassID spec_class, uint16_t 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_t width, uint8_t length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, RoadStopClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent)
 Build a bus or truck stop. More...
 
CommandCost CmdRemoveRoadStop (DoCommandFlag flags, TileIndex tile, uint8_t width, uint8_t 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()

CommandCost CmdBuildAirport ( DoCommandFlag  flags,
TileIndex  tile,
uint8_t  airport_type,
uint8_t  layout,
StationID  station_to_join,
bool  allow_adjacent 
)

Place an Airport.

Parameters
flagsoperation to perform
tiletile where airport will be built
airport_typeairport type,
See also
airport.h
Parameters
layoutairport layout
station_to_joinstation ID to join (NEW_STATION if build new one)
allow_adjacentallow airports directly adjacent to other airports.
Returns
the cost of this operation or an error

Definition at line 2528 of file station_cmd.cpp.

◆ CmdBuildDock()

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

Build a dock/haven.

Parameters
flagsoperation to perform
tiletile where dock will be built
station_to_joinstation ID to join (NEW_STATION if build new one)
adjacentallow docks directly adjacent to other docks.
Returns
the cost of this operation or an error

Definition at line 2795 of file station_cmd.cpp.

◆ CmdBuildRailStation()

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

Build rail station.

Parameters
flagsoperation to perform
tile_orgnorthern most position of station dragging/placement
rtrailtype
axisorientation (Axis)
numtracksnumber of tracks
plat_lenplatform length
spec_classcustom station class
spec_indexcustom station id
station_to_joinstation ID to join (NEW_STATION if build new one)
adjacentallow stations directly adjacent to other stations.
Returns
the cost of this operation or an error

Definition at line 1344 of file station_cmd.cpp.

◆ CmdBuildRoadStop()

CommandCost CmdBuildRoadStop ( DoCommandFlag  flags,
TileIndex  tile,
uint8_t  width,
uint8_t  length,
RoadStopType  stop_type,
bool  is_drive_through,
DiagDirection  ddir,
RoadType  rt,
RoadStopClassID  spec_class,
uint16_t  spec_index,
StationID  station_to_join,
bool  adjacent 
)

Build a bus or truck stop.

Parameters
flagsOperation to perform.
tileNorthernmost tile of the stop.
widthWidth of the road stop.
lengthLength of the road stop.
stop_typeType of road stop (bus/truck).
is_drive_throughFalse for normal stops, true for drive-through.
ddirEntrance direction (DiagDirection) for normal stops. Converted to the axis for drive-through stops.
rtThe roadtype.
spec_classRoad stop spec class.
spec_indexRoad stop spec index.
station_to_joinStation ID to join (NEW_STATION if build new one).
adjacentAllow stations directly adjacent to other stations.
Returns
The cost of this operation or an error.

Definition at line 1964 of file station_cmd.cpp.

◆ CmdOpenCloseAirport()

◆ 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
flagsoperation to perform
starttile of station piece to remove
endother edge of the rect to remove
keep_railif set keep the rail
Returns
the cost of this operation or an error

Definition at line 1749 of file station_cmd.cpp.

References CMD_ERROR, RemoveFromRailBaseStation(), and Map::Size().

◆ CmdRemoveRoadStop()

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

Remove bus or truck stops.

Parameters
flagsOperation to perform.
tileNorthernmost tile of the removal area.
widthWidth of the removal area.
heightHeight of the removal area.
stop_typeType of stop (bus/truck).
remove_roadRemove roads of drive-through stops?
Returns
The cost of this operation or an error.

Definition at line 2384 of file station_cmd.cpp.

References CMD_ERROR, DC_BANKRUPT, INVALID_TILE, IsValidTile(), RemoveGenericRoadStop(), ROADSTOP_BUS, ROADSTOP_END, and TileAddWrap().

◆ CmdRenameStation()

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

Rename a station.

Parameters
flagsoperation to perform
station_idstation ID that is to be renamed
textthe new name or an empty string when resetting to the default
Returns
the cost of this operation or an error

Definition at line 4317 of file station_cmd.cpp.

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