OpenTTD Source  14.0-beta3
waypoint_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 CmdBuildRailWaypoint (DoCommandFlag flags, TileIndex start_tile, Axis axis, byte width, byte height, StationClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent)
 Convert existing rail to waypoint. More...
 
CommandCost CmdRemoveFromRailWaypoint (DoCommandFlag flags, TileIndex start, TileIndex end, bool keep_rail)
 Remove a single tile from a waypoint. More...
 
CommandCost CmdBuildBuoy (DoCommandFlag flags, TileIndex tile)
 Build a buoy. More...
 
CommandCost CmdRenameWaypoint (DoCommandFlag flags, StationID waypoint_id, const std::string &text)
 Rename a waypoint. More...
 

Detailed Description

Command definitions related to waypoints.

Definition in file waypoint_cmd.h.

Function Documentation

◆ CmdBuildBuoy()

CommandCost CmdBuildBuoy ( DoCommandFlag  flags,
TileIndex  tile 
)

Build a buoy.

Parameters
flagsoperation to perform
tiletile where to place the buoy
Returns
the cost of this operation or an error

Definition at line 312 of file waypoint_cmd.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::CanAllocateItem(), EXPENSES_CONSTRUCTION, FindDeletedWaypointCloseTo(), HasTileWaterGround(), IsBridgeAbove(), IsTileFlat(), OWNER_NONE, and return_cmd_error.

◆ CmdBuildRailWaypoint()

enum StationClassID byte CommandCost CmdBuildRailWaypoint ( DoCommandFlag  flags,
TileIndex  start_tile,
Axis  axis,
byte  width,
byte  height,
StationClassID  spec_class,
uint16_t  spec_index,
StationID  station_to_join,
bool  adjacent 
)

Convert existing rail to waypoint.

Eg build a waypoint station over piece of rail

Parameters
flagstype of operation
start_tilenorthern most tile where waypoint will be built
axisorientation (Axis)
widthwidth of waypoint
heightheight of waypoint
spec_classcustom station class
spec_indexcustom station id
station_to_joinstation ID to join (NEW_STATION if build new one)
adjacentallow waypoints directly adjacent to other waypoints.
Returns
the cost of this operation or an error

Definition at line 176 of file waypoint_cmd.cpp.

◆ CmdRemoveFromRailWaypoint()

CommandCost CmdRemoveFromRailWaypoint ( DoCommandFlag  flags,
TileIndex  start,
TileIndex  end,
bool  keep_rail 
)

Remove a single tile from a waypoint.

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

Parameters
flagsoperation to perform
starttile of waypoint 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 1751 of file station_cmd.cpp.

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

◆ CmdRenameWaypoint()

CommandCost CmdRenameWaypoint ( DoCommandFlag  flags,
StationID  waypoint_id,
const std::string &  text 
)

Rename a waypoint.

Parameters
flagstype of operation
waypoint_idid of waypoint
textthe new name or an empty string when resetting to the default
Returns
the cost of this operation or an error

Definition at line 421 of file waypoint_cmd.cpp.

References CheckOwnership(), CMD_ERROR, DC_EXEC, CommandCost::Failed(), SpecializedStation< Waypoint, true >::GetIfValid(), IsUniqueWaypointName(), MAX_LENGTH_STATION_NAME_CHARS, BaseStation::name, BaseStation::owner, OWNER_NONE, return_cmd_error, Waypoint::UpdateVirtCoord(), and Utf8StringLength().