# station.h File Reference

`#include "airport.h"`
`#include "oldpool.h"`
`#include "sprite.h"`
`#include "road_type.h"`
`#include "newgrf_station.h"`
`#include "cargopacket.h"`
`#include "cargo_type.h"`
`#include "town_type.h"`
`#include "core/geometry_type.hpp"`
`#include <list>`
`#include <set>`

Go to the source code of this file.

## Data Structures
struct | GoodsEntry
struct | RoadStop
| A Stop for a Road Vehicle. More...
struct | StationSpecList
struct | StationRect
| StationRect - used to track station spread out rectangle - cheaper than scanning whole map. More...
struct | Station
## Defines
#define | FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1U < GetStationPoolSize()) ? GetStation(st->index + 1U) : NULL) if (st->IsValid())
#define | FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0)
#define | FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) if (rs->IsValid())
#define | FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0)
## Typedefs
typedef std::set< Station * > | StationSet
| A set of stations (`const` `Station*` ).
## Enumerations
enum | StationType { STATION_RAIL, STATION_AIRPORT, STATION_TRUCK, STATION_BUS, STATION_OILRIG, STATION_DOCK, STATION_BUOY }
enum | { FACIL_TRAIN = 0x01, FACIL_TRUCK_STOP = 0x02, FACIL_BUS_STOP = 0x04, FACIL_AIRPORT = 0x08, FACIL_DOCK = 0x10 }
enum | { HVOT_TRAIN = 1 << 1, HVOT_BUS = 1 << 2, HVOT_TRUCK = 1 << 3, HVOT_AIRCRAFT = 1 << 4, HVOT_SHIP = 1 << 5, HVOT_BUOY = 1 << 6 }
enum | CatchmentArea { CA_NONE = 0, CA_BUS = 3, CA_TRUCK = 3, CA_TRAIN = 4, CA_DOCK = 5, CA_UNMODIFIED = 4, MAX_CATCHMENT = 10 }
## Functions
void | ModifyStationRatingAround (TileIndex tile, PlayerID owner, int amount, uint radius)
StationSet | FindStationsAroundIndustryTile (TileIndex tile, int w, int h)
| Find all (non-buoy) stations around an industry tile.
void | ShowStationViewWindow (StationID station)
| Opens StationViewWindow for given station.
void | UpdateAllStationVirtCoord ()
| Update the virtual coords needed to draw the station sign for all stations.
static StationID | GetMaxStationIndex ()
static uint | GetNumStations ()
static bool | IsValidStationID (StationID index)
void | AfterLoadStations ()
void | GetProductionAroundTiles (AcceptedCargo produced, TileIndex tile, int w, int h, int rad)
| Get a list of the cargo types being produced around the tile (in a rectangle).
void | GetAcceptanceAroundTiles (AcceptedCargo accepts, TileIndex tile, int w, int h, int rad)
| Get a list of the cargo types that are accepted around the tile.
const DrawTileSprites * | GetStationTileLayout (StationType st, byte gfx)
void | StationPickerDrawSprite (int x, int y, StationType st, RailType railtype, RoadType roadtype, int image)
RoadStop * | GetRoadStopByTile (TileIndex tile, RoadStop::Type type)
uint | GetNumRoadStops (const Station *st, RoadStop::Type type)
RoadStop * | AllocateRoadStop ()
void | ClearSlot (Vehicle *v)
bool | HasStationInUse (StationID station, PlayerID player)
| Tests whether the player's vehicles have this station in orders When player == INVALID_PLAYER, then check all vehicles.
void | DeleteOilRig (TileIndex t)
## Variables
static const byte | INITIAL_STATION_RATING = 175

## Detailed Description

Definition in file station.h.

## Enumeration Type Documentation

enum CatchmentArea

Enumerator:

  CA_UNMODIFIED | Used when _patches.modified_catchment is false.
  MAX_CATCHMENT | Airports have a catchment up to this number.

Definition at line 235 of file station.h.

## Function Documentation

StationSet FindStationsAroundIndustryTile | ( | TileIndex | tile,
|  | int | w,
|  | int | h |
| ) |  |  |

Find all (non-buoy) stations around an industry tile.

Parameters:

  | tile,: | Center tile to search from
  | w,: | Width of the center
  | h,: | Height of the center

Returns:
  : Set of found stations

Definition at line 2669 of file station_cmd.cpp.

References BEGIN_TILE_LOOP, CA_UNMODIFIED, END_TILE_LOOP, FindCatchmentRadius(), IsTileType(), MAX_CATCHMENT, min(), TILE_MASK, and TileDiffXY().

Referenced by WhoCanServiceIndustry().

void GetAcceptanceAroundTiles | ( | AcceptedCargo | accepts,
|  | TileIndex | tile,
|  | int | w,
|  | int | h,
|  | int | rad |
| ) |  |  |

Get a list of the cargo types that are accepted around the tile.

Parameters:

  | accepts,: | Destination array of accepted cargo
  | tile,: | Center of the search area
  | w,: | Width of the center
  | h,: | Height of the center
  | rad,: | Radius of the rectangular search area

Definition at line 492 of file station_cmd.cpp.

References IsTileType(), MapSizeX(), MapSizeY(), max(), min(), TileX(), TileXY(), and TileY().

Referenced by UpdateStationAcceptance().

void GetProductionAroundTiles | ( | AcceptedCargo | produced,
|  | TileIndex | tile,
|  | int | w,
|  | int | h,
|  | int | rad |
| ) |  |  |

Get a list of the cargo types being produced around the tile (in a rectangle).

Parameters:

  | produced,: | Destination array of produced cargo
  | tile,: | Center of the search area
  | w,: | Width of the center
  | h,: | Height of the center
  | rad,: | Radius of the search area

Definition at line 444 of file station_cmd.cpp.

References GetTileType(), IsInsideBS(), MapSizeX(), MapSizeY(), max(), min(), TileX(), TileXY(), and TileY().

bool HasStationInUse | ( | StationID | station,
|  | PlayerID | player |
| ) |  |  |

Tests whether the player's vehicles have this station in orders When player == INVALID_PLAYER, then check all vehicles.

Parameters:

  | station | station ID
  | player | player ID, INVALID_PLAYER to disable the check

Definition at line 1866 of file station_cmd.cpp.

References INVALID_PLAYER.

Referenced by BuildStationsList().

void ShowStationViewWindow | ( | StationID | station | ) |

Opens StationViewWindow for given station.

Parameters:

  | station | station which window should be opened

Definition at line 986 of file station_gui.cpp.

References AllocateWindowDescFront(), and OWNER_NONE.

void UpdateAllStationVirtCoord | ( |  | ) |

Update the virtual coords needed to draw the station sign for all stations.

Definition at line 385 of file station_cmd.cpp.

References UpdateStationVirtCoord().