OpenTTD Source: src/waypoint_cmd.h File Reference

OpenTTD Source 15.0-beta1

Functions
waypoint_cmd.h File Reference

Command definitions related to waypoints. More...

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

Go to the source code of this file.

## Functions
CommandCost | CmdBuildRailWaypoint (DoCommandFlag flags, TileIndex start_tile, Axis axis, uint8_t width, uint8_t height, StationClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent)
| Convert existing rail to waypoint.
CommandCost | CmdRemoveFromRailWaypoint (DoCommandFlag flags, TileIndex start, TileIndex end, bool keep_rail)
| Remove a single tile from a waypoint.
CommandCost | CmdBuildRoadWaypoint (DoCommandFlag flags, TileIndex start_tile, Axis axis, uint8_t width, uint8_t height, RoadStopClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent)
| Build a road waypoint on an existing road.
CommandCost | CmdRemoveFromRoadWaypoint (DoCommandFlag flags, TileIndex start, TileIndex end)
| Remove road waypoints.
CommandCost | CmdBuildBuoy (DoCommandFlag flags, TileIndex tile)
| Build a buoy.
CommandCost | CmdRenameWaypoint (DoCommandFlag flags, StationID waypoint_id, const std::string &text)
| Rename a waypoint.

## 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

  flags | operation to perform
  tile | tile where to place the buoy

Returns
  the cost of this operation or an error

Definition at line 468 of file waypoint_cmd.cpp.

References CommandCost::AddCost(), BaseStation::build_date, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::CanAllocateItem(), CheckForDockingTile(), ClearNeighbourNonFloodingStates(), TimerGameCalendar::date, DC_AUTO, DC_EXEC, EXPENSES_CONSTRUCTION, FACIL_DOCK, BaseStation::facilities, CommandCost::Failed(), FindDeletedWaypointCloseTo(), GetWaterClass(), HasTileWaterGround(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, InvalidateWindowData(), IsBridgeAbove(), IsTileFlat(), IsWaterTile(), MakeBuoy(), MakeDefaultName(), MarkTileDirtyByTile(), BaseStation::owner, OWNER_NONE, BaseStation::rect, BaseStation::string_id, BaseStation::town, Waypoint::UpdateVirtCoord(), WC_WAYPOINT_VIEW, and BaseStation::xy.

## ◆ CmdBuildRailWaypoint()

CommandCost CmdBuildRailWaypoint | ( | DoCommandFlag | flags,
|  | TileIndex | start_tile,
|  | Axis | axis,
|  | uint8_t | width,
|  | uint8_t | 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

  flags | type of operation
  start_tile | northern most tile where waypoint will be built
  axis | orientation (Axis)
  width | width of waypoint
  height | height of waypoint
  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 waypoints directly adjacent to other waypoints.

Returns
  the cost of this operation or an error

Definition at line 203 of file waypoint_cmd.cpp.

References _current_company, _settings_game, CommandCost::AddCost(), AllocateSpecToStation(), AXIS_X, AxisToTrack(), BaseStation::build_date, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::CanAllocateItem(), CanExpandRailStation(), CMD_ERROR, TimerGameCalendar::date, DC_EXEC, DeallocateSpecFromStation(), BaseStation::delete_ctr, DirtyCompanyInfrastructureWindows(), StationSettings::distant_join_stations, EXPENSES_CONSTRUCTION, FACIL_TRAIN, BaseStation::facilities, CommandCost::Failed(), FindDeletedWaypointCloseTo(), FindJoiningWaypoint(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), NewGRFClass< Tspec, Tindex, Tmax >::Get(), NewGRFClass< Tspec, Tindex, Tmax >::GetClassCount(), GetCustomStationSpecIndex(), GetRailReservationTrackBits(), GetRailType(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpec(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpecCount(), GetStationLayout(), GetTileOwner(), HasBit(), HasStationReservation(), HasStationTileRail(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::infrastructure, INVALID_TILE, BaseStation::IsInUse(), IsRailWaypointTile(), IsTileType(), IsValidAxis(), SpecializedStation< Waypoint, true >::IsValidID(), IsValidTileForWaypoint(), IsWaypointClass(), MakeDefaultName(), MakeRailWaypoint(), MarkTileDirtyByTile(), MP_RAILWAY, OtherAxis(), BaseStation::owner, BaseStation::rect, SetCustomStationSpecIndex(), SetRailStationReservation(), SetRailStationTileFlags(), CompanyInfrastructure::station, GameSettings::station, StationSettings::station_spread, BaseStation::string_id, OrthogonalTileArea::tile, TileOffsByAxis(), BaseStation::town, BaseStation::train_station, Waypoint::UpdateVirtCoord(), BaseStation::xy, and YapfNotifyTrackLayoutChange().

## ◆ CmdBuildRoadWaypoint()

CommandCost CmdBuildRoadWaypoint | ( | DoCommandFlag | flags,
|  | TileIndex | start_tile,
|  | Axis | axis,
|  | uint8_t | width,
|  | uint8_t | height,
|  | RoadStopClassID | spec_class,
|  | uint16_t | spec_index,
|  | StationID | station_to_join,
|  | bool | adjacent
| ) |  |

Build a road waypoint on an existing road.

Parameters

  flags | type of operation.
  start_tile | northern most tile where waypoint will be built.
  axis | orientation (Axis).
  width | width of waypoint.
  height | height of waypoint.
  spec_class | custom road stop class.
  spec_index | custom road stop id.
  station_to_join | station ID to join (NEW_STATION if build new one).
  adjacent | allow waypoints directly adjacent to other waypoints.

Returns
  the cost of this operation or an error.

Definition at line 335 of file waypoint_cmd.cpp.

References _current_company, _settings_game, OrthogonalTileArea::Add(), AXIS_X, AxisToDiagDir(), BaseStation::build_date, BaseStation::cached_roadstop_anim_triggers, CalculateRoadStopCost(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::CanAllocateItem(), CMD_ERROR, CountBits(), TimerGameCalendar::date, DC_EXEC, BaseStation::delete_ctr, DirtyCompanyInfrastructureWindows(), StationSettings::distant_join_stations, FACIL_BUS_STOP, FACIL_TRUCK_STOP, BaseStation::facilities, CommandCost::Failed(), FindDeletedWaypointCloseTo(), FindJoiningWaypoint(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), NewGRFClass< Tspec, Tindex, Tmax >::Get(), RoadStopSpec::GetBuildCost(), NewGRFClass< Tspec, Tindex, Tmax >::GetClassCount(), GetRoadBits(), GetRoadOwner(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpec(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpecCount(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_ROADTYPE, BaseStation::IsInUse(), IsNormalRoadTile(), IsRoadWaypointTile(), IsValidAxis(), SpecializedStation< Waypoint, true >::IsValidID(), IsWaypointClass(), MakeDefaultName(), MakeDriveThroughRoadStop(), MarkTileDirtyByTile(), MayHaveRoad(), OtherAxis(), BaseStation::owner, BaseStation::rect, RemoveRoadWaypointStop(), ROAD_STOP_TRACKBIT_FACTOR, Waypoint::road_waypoint_area, SetBit(), SetCustomRoadStopSpecIndex(), GameSettings::station, StationSettings::station_spread, BaseStation::string_id, TileOffsByAxis(), BaseStation::town, AnimationInfo::triggers, UpdateCompanyRoadInfrastructure(), Waypoint::UpdateVirtCoord(), Waypoint::waypoint_flags, WPF_ROAD, and BaseStation::xy.

## ◆ 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

  flags | operation to perform
  start | tile of waypoint 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 1782 of file station_cmd.cpp.

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

## ◆ CmdRemoveFromRoadWaypoint()

CommandCost CmdRemoveFromRoadWaypoint | ( | DoCommandFlag | flags,
|  | TileIndex | start,
|  | TileIndex | end
| ) |  |

Remove road waypoints.

Parameters

  flags | operation to perform
  start | tile of road waypoint piece to remove
  end | other edge of the rect to remove

Returns
  the cost of this operation or an error

Definition at line 2403 of file station_cmd.cpp.

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

## ◆ CmdRenameWaypoint()

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

Rename a waypoint.

Parameters

  flags | type of operation
  waypoint_id | id of waypoint
  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 578 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, Waypoint::UpdateVirtCoord(), and Utf8StringLength().