OpenTTD Source: src/waypoint_func.h File Reference

OpenTTD Source 15.0-RC2

Functions
waypoint_func.h File Reference

Functions related to waypoints. More...

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

Go to the source code of this file.

## Functions
CommandCost | RemoveBuoy (TileIndex tile, DoCommandFlags flags)
| Remove a buoy.
Axis | GetAxisForNewRailWaypoint (TileIndex tile)
| Get the axis for a new rail waypoint.
Axis | GetAxisForNewRoadWaypoint (TileIndex tile)
| Get the axis for a new road waypoint.
void | ShowWaypointWindow (const Waypoint *wp)
| Show the window for the given waypoint.
void | DrawWaypointSprite (int x, int y, StationClassID station_class, uint16_t station_type, RailType railtype)
| Draw a waypoint.

## Detailed Description

Functions related to waypoints.

Definition in file waypoint_func.h.

## Function Documentation

## ◆ DrawWaypointSprite()

void DrawWaypointSprite | ( | int | x,
|  | int | y,
|  | StationClassID | station_class,
|  | uint16_t | station_type,
|  | RailType | railtype
| ) |  |

Draw a waypoint.

Parameters

  x | coordinate
  y | coordinate
  station_class | Station class.
  station_type | Station type within class.
  railtype | RailType to use for

Definition at line 28 of file waypoint.cpp.

References AXIS_X, DrawStationTile(), and INVALID_ROADTYPE.

Referenced by WaypointPickerCallbacks::DrawType().

## ◆ GetAxisForNewRailWaypoint()

Axis GetAxisForNewRailWaypoint | ( | TileIndex | tile | ) |

Get the axis for a new rail waypoint.

This means that if it is a valid tile to build a waypoint on it returns a valid Axis, otherwise an invalid one.

Parameters

  tile | the tile to look at.

Returns
  the axis for the to-be-build waypoint.

Definition at line 106 of file waypoint_cmd.cpp.

References AXIS_X, AXIS_Y, GetRailStationAxis(), GetRailTileType(), GetTrackBits(), INVALID_AXIS, IsRailWaypointTile(), IsTileType(), MP_RAILWAY, Normal, TRACK_BIT_X, and TRACK_BIT_Y.

Referenced by IsValidTileForWaypoint(), and PlaceRail_Waypoint().

## ◆ GetAxisForNewRoadWaypoint()

Axis GetAxisForNewRoadWaypoint | ( | TileIndex | tile | ) |

Get the axis for a new road waypoint.

This means that if it is a valid tile to build a waypoint on it returns a valid Axis, otherwise an invalid one.

Parameters

  tile | the tile to look at.

Returns
  the axis for the to-be-build waypoint.

Definition at line 128 of file waypoint_cmd.cpp.

References AXIS_X, AXIS_Y, GetAllRoadBits(), GetDriveThroughStopAxis(), INVALID_AXIS, IsNormalRoadTile(), IsRoadWaypointTile(), ROAD_X, and ROAD_Y.

Referenced by PlaceRoad_Waypoint().

## ◆ RemoveBuoy()

CommandCost RemoveBuoy | ( | TileIndex | tile,
|  | DoCommandFlags | flags
| ) |  |

Remove a buoy.

Parameters

  tile | TileIndex been queried
  flags | operation to perform

Precondition
  IsBuoyTile(tile)

Returns
  cost or failure of operation

Definition at line 530 of file waypoint_cmd.cpp.

References _current_company, Bankrupt, BaseStation::delete_ctr, Dock, EnsureNoVehicleOnGround(), Execute, EXPENSES_CONSTRUCTION, BaseStation::facilities, CommandCost::Failed(), BaseStation::GetByTile(), GetTileOwner(), HasStationInUse(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, INVALID_STRING_ID, InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID(), BaseStation::rect, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Waypoint::UpdateVirtCoord(), and WC_WAYPOINT_VIEW.

Referenced by ClearTile_Station().

## ◆ ShowWaypointWindow()

void ShowWaypointWindow | ( | const Waypoint * | wp | ) |

Show the window for the given waypoint.

Parameters

  wp | The waypoint to show the window for.

Definition at line 232 of file waypoint_gui.cpp.

References _waypoint_view_desc, and Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index.