# station_map.h File Reference

Maps accessors for stations. More...

`#include "rail_map.h"`
`#include "road_map.h"`
`#include "water_map.h"`
`#include "station_func.h"`
`#include "station_base.h"`
`#include "rail.h"`

Go to the source code of this file.

## Typedefs
typedef byte | StationGfx
## Enumerations
enum | { GFX_RADAR_LARGE_FIRST = 31, GFX_RADAR_LARGE_LAST = 42, GFX_WINDSACK_FIRST = 50, GFX_WINDSACK_LAST = 53, GFX_DOCK_BASE_WATER_PART = 4, GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET = 4, GFX_RADAR_INTERNATIONAL_FIRST = 66, GFX_RADAR_INTERNATIONAL_LAST = 77, GFX_RADAR_METROPOLITAN_FIRST = 78, GFX_RADAR_METROPOLITAN_LAST = 89, GFX_RADAR_DISTRICTWE_FIRST = 121, GFX_RADAR_DISTRICTWE_LAST = 132, GFX_WINDSACK_INTERCON_FIRST = 140, GFX_WINDSACK_INTERCON_LAST = 143 }
## Functions
static StationID | GetStationIndex (TileIndex t)
| Get Station ID from a tile.
static Station * | GetStationByTile (TileIndex t)
static StationType | GetStationType (TileIndex t)
static RoadStopType | GetRoadStopType (TileIndex t)
static StationGfx | GetStationGfx (TileIndex t)
static void | SetStationGfx (TileIndex t, StationGfx gfx)
static uint8 | GetStationAnimationFrame (TileIndex t)
static void | SetStationAnimationFrame (TileIndex t, uint8 frame)
static bool | IsRailwayStation (TileIndex t)
static bool | IsRailwayStationTile (TileIndex t)
static bool | IsAirport (TileIndex t)
bool | IsHangar (TileIndex t)
| Check whether the given tile is a hangar.
static bool | IsTruckStop (TileIndex t)
| Is the station at t a truck stop?
static bool | IsBusStop (TileIndex t)
| Is the station at t a bus stop?
static bool | IsRoadStop (TileIndex t)
| Is the station at t a road station?
static bool | IsRoadStopTile (TileIndex t)
static bool | IsStandardRoadStopTile (TileIndex t)
static bool | IsDriveThroughStopTile (TileIndex t)
static bool | GetStopBuiltOnTownRoad (TileIndex t)
static void | SetStopBuiltOnTownRoad (TileIndex t, bool on_town_road)
static DiagDirection | GetRoadStopDir (TileIndex t)
| Gets the direction the road stop entrance points towards.
static bool | IsOilRig (TileIndex t)
static bool | IsDock (TileIndex t)
static bool | IsDockTile (TileIndex t)
static bool | IsBuoy (TileIndex t)
static bool | IsBuoyTile (TileIndex t)
static bool | IsHangarTile (TileIndex t)
static Axis | GetRailStationAxis (TileIndex t)
static Track | GetRailStationTrack (TileIndex t)
static bool | IsCompatibleTrainStationTile (TileIndex t1, TileIndex t2)
static bool | GetRailwayStationReservation (TileIndex t)
| Get the reservation state of the rail station.
static void | SetRailwayStationReservation (TileIndex t, bool b)
| Set the reservation state of the rail station.
static TrackBits | GetRailStationReservation (TileIndex t)
| Get the reserved track bits for a waypoint.
static DiagDirection | GetDockDirection (TileIndex t)
static TileIndexDiffC | GetDockOffset (TileIndex t)
static bool | IsCustomStationSpecIndex (TileIndex t)
static void | SetCustomStationSpecIndex (TileIndex t, byte specindex)
static uint | GetCustomStationSpecIndex (TileIndex t)
static void | SetStationTileRandomBits (TileIndex t, byte random_bits)
static byte | GetStationTileRandomBits (TileIndex t)
static void | MakeStation (TileIndex t, Owner o, StationID sid, StationType st, byte section)
static void | MakeRailStation (TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
static void | MakeRoadStop (TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadTypes rt, DiagDirection d)
static void | MakeDriveThroughRoadStop (TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadTypes rt, Axis a, bool on_town_road)
static void | MakeAirport (TileIndex t, Owner o, StationID sid, byte section)
static void | MakeBuoy (TileIndex t, StationID sid, WaterClass wc)
static void | MakeDock (TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
static void | MakeOilrig (TileIndex t, StationID sid, WaterClass wc)

## Detailed Description

Maps accessors for stations.

Definition in file station_map.h.

## Function Documentation

static TrackBits GetRailStationReservation | ( | TileIndex | t | ) | `[inline, static]`

Get the reserved track bits for a waypoint.

Precondition:
  IsRailwayStationTile(t)

Parameters:

  | t | the tile

Returns:
  reserved track bits

Definition at line 259 of file station_map.h.

References AxisToTrackBits(), GetRailwayStationReservation(), and TRACK_BIT_NONE.

Referenced by GetReservedTrackbits().

static bool GetRailwayStationReservation | ( | TileIndex | t | ) | `[inline, static]`

Get the reservation state of the rail station.

Precondition:
  IsRailwayStationTile(t)

Parameters:

  | t | the station tile

Returns:
  reservation state

Definition at line 235 of file station_map.h.

References _m, and HasBit().

Referenced by CmdBuildRailroadStation(), CmdRemoveFromRailroadStation(), GetRailStationReservation(), and TryReserveRailTrack().

static StationID GetStationIndex | ( | TileIndex | t | ) | `[inline, static]`

Get Station ID from a tile.

Precondition:
  Tile must be part of the station

Parameters:

  | t | Tile to query station ID from

Returns:
  Station ID of the station at t

Definition at line 21 of file station_map.h.

References _m, IsTileType(), Tile::m2, and MP_STATION.

Referenced by AddNearbyStation(), AITileList_StationType::AITileList_StationType(), CheckFlatLandBelow(), CheckNextTrainTile(), CmdBuildAircraft(), CmdReverseTrainDirection(), DeallocateSpecFromStation(), DisasterTick_Zeppeliner(), FreeTrainTrackReservation(), AIAirport::GetAirportType(), AIStation::GetStationID(), GetTrainAcceleration(), AIOrder::InsertOrder(), LoadUnloadVehicle(), ProcessOrders(), and StationRect::ScanForStationTiles().

static bool IsBusStop | ( | TileIndex | t | ) | `[inline, static]`

Is the station at t a bus stop?

Parameters:

  | t | Tile to check

Returns:
  `true` if station is a bus stop, `false` otherwise

Definition at line 117 of file station_map.h.

Referenced by IsRoadStop().

bool IsHangar | ( | TileIndex | t | ) |

Check whether the given tile is a hangar.

Parameters:

  | t | the tile to of whether it is a hangar.

Precondition:
  IsTileType(t, MP_STATION)

Returns:
  true if and only if the tile is a hangar.

Definition at line 48 of file station_cmd.cpp.

References Station::Airport(), AirportFTAClass::airport_depots, Station::airport_tile, IsTileType(), MP_STATION, AirportFTAClass::nof_depots, and ToTileIndexDiff().

Referenced by AIAirport::IsHangarTile().

static bool IsRoadStop | ( | TileIndex | t | ) | `[inline, static]`

Is the station at t a road station?

Precondition:
  Tile at t is a station tile

Parameters:

  | t | Tile to check

Returns:
  `true` if station at the tile is a bus top or a truck stop, `false` otherwise

Definition at line 127 of file station_map.h.

References IsBusStop(), IsTileType(), IsTruckStop(), and MP_STATION.

Referenced by CmdRemoveRoadStop(), and AIRoad::RemoveRoadStation().

static bool IsTruckStop | ( | TileIndex | t | ) | `[inline, static]`

Is the station at t a truck stop?

Parameters:

  | t | Tile to check

Returns:
  `true` if station is a truck stop, `false` otherwise

Definition at line 108 of file station_map.h.

Referenced by IsRoadStop(), and RemoveRoadStop().

static void SetRailwayStationReservation | ( | TileIndex | t,
|  | bool | b |
| ) |  |  | `[inline, static]`

Set the reservation state of the rail station.

Precondition:
  IsRailwayStationTile(t)

Parameters:

  | t | the station tile
  | b | the reservation state

Definition at line 247 of file station_map.h.

References _m, and SB().

Referenced by NPFSaveTargetData(), SetRailwayStationPlatformReservation(), TryReserveRailTrack(), and UnreserveRailTrack().