# waypoint.h File Reference

Base of waypoints. More...

`#include "waypoint_type.h"`
`#include "oldpool.h"`
`#include "rail_map.h"`
`#include "command_type.h"`
`#include "station_type.h"`
`#include "town_type.h"`
`#include "viewport_type.h"`
`#include "date_type.h"`

Go to the source code of this file.

## Data Structures
struct | Waypoint
## Defines
#define | FOR_ALL_WAYPOINTS_FROM(wp, start) for (wp = GetWaypoint(start); wp != NULL; wp = (wp->index + 1U < GetWaypointPoolSize()) ? GetWaypoint(wp->index + 1U) : NULL) if (wp->IsValid())
#define | FOR_ALL_WAYPOINTS(wp) FOR_ALL_WAYPOINTS_FROM(wp, 0)
## Functions
static bool | IsValidWaypointID (WaypointID index)
static Waypoint * | GetWaypointByTile (TileIndex tile)
| Fetch a waypoint by tile.
CommandCost | RemoveTrainWaypoint (TileIndex tile, DoCommandFlag flags, bool justremove)
| Remove a waypoint.
Station * | ComposeWaypointStation (TileIndex tile)
| This hacks together some dummy one-shot Station structure for a waypoint.
void | ShowWaypointWindow (const Waypoint *wp)
void | DrawWaypointSprite (int x, int y, int stat_id, RailType railtype)
| Draw a waypoint.
void | UpdateAllWaypointSigns ()
| Update all signs.

## Detailed Description

Base of waypoints.

Definition in file waypoint.h.

## Function Documentation

Station* ComposeWaypointStation | ( | TileIndex | tile | ) |

This hacks together some dummy one-shot Station structure for a waypoint.

Parameters:

  | tile | on which to work

Returns:
  pointer to a Station

Definition at line 379 of file waypoint.cpp.

References GetWaypointByTile().

void DrawWaypointSprite | ( | int | x,
|  | int | y,
|  | int | stat_id,
|  | RailType | railtype |
| ) |  |  |

Draw a waypoint.

Parameters:

  | x | coordinate
  | y | coordinate
  | stat_id | station id
  | railtype | RailType to use for

Definition at line 402 of file waypoint.cpp.

References AXIS_X, DrawStationTile(), and STAT_CLASS_WAYP.

static Waypoint* GetWaypointByTile | ( | TileIndex | tile | ) | `[inline, static]`

Fetch a waypoint by tile.

Parameters:

  | tile | Tile of waypoint

Returns:
  Waypoint

Definition at line 57 of file waypoint.h.

References GetWaypointIndex(), and IsRailWaypointTile().

Referenced by ComposeWaypointStation(), and RemoveTrainWaypoint().

CommandCost RemoveTrainWaypoint | ( | TileIndex | tile,
|  | DoCommandFlag | flags,
|  | bool | justremove |
| ) |  |  |

Remove a waypoint.

Parameters:

  | tile | from which to remove waypoint
  | flags | type of operation
  | justremove | will indicate if it is removed from rail or if rails are removed too

Returns:
  cost of operation or error

Definition at line 273 of file waypoint.cpp.

References AddTrackToSignalBuffer(), CMD_ERROR, DC_EXEC, FreeTrainTrackReservation(), GetDepotWaypointReservation(), GetRailType(), GetRailWaypointBits(), GetRailWaypointTrack(), GetTrainForReservation(), GetWaypointByTile(), IsRailWaypointTile(), MarkTileDirtyByTile(), OWNER_WATER, RedrawWaypointSign(), SetTrackReservation(), TryPathReserve(), and YapfNotifyTrackLayoutChange().

Referenced by CmdRemoveTrainWaypoint().