# station_func.h File Reference

Functions related to stations. More...

`#include "station_type.h"`
`#include "sprite.h"`
`#include "oldpool.h"`
`#include "rail_type.h"`
`#include "road_type.h"`
`#include "tile_type.h"`
`#include "cargo_type.h"`
`#include "vehicle_type.h"`
`#include "core/smallvec_type.hpp"`

Go to the source code of this file.

## Typedefs
typedef SmallVector< Station *, 1 > | StationList
## Functions
void | ModifyStationRatingAround (TileIndex tile, Owner owner, int amount, uint radius)
void | FindStationsAroundTiles (TileIndex tile, int w_prod, int h_prod, StationList *stations)
| Find all (non-buoy) stations around a rectangular producer (industry, house, headquarter, .
void | ShowStationViewWindow (StationID station)
| Opens StationViewWindow for given station.
void | UpdateAllStationVirtCoord ()
| Update the virtual coords needed to draw the station sign for all stations.
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)
bool | HasStationInUse (StationID station, CompanyID company)
| Tests whether the company's vehicles have this station in orders When company == INVALID_COMPANY, then check all vehicles.
RoadStop * | GetRoadStopByTile (TileIndex tile, RoadStopType type)
uint | GetNumRoadStops (const Station *st, RoadStopType type)
RoadStop * | AllocateRoadStop ()
void | ClearSlot (Vehicle *v)
void | DeleteOilRig (TileIndex t)
bool | IsStationTileBlocked (TileIndex tile)
bool | IsStationTileElectrifiable (TileIndex tile)
void | UpdateAirportsNoise ()
| Recalculate the noise generated by the airports of each town.

## Detailed Description

Functions related to stations.

Definition in file station_func.h.

## Function Documentation

void FindStationsAroundTiles | ( | TileIndex | tile,
|  | int | w_prod,
|  | int | h_prod,
|  | StationList * | stations |
| ) |  |  |

Find all (non-buoy) stations around a rectangular producer (industry, house, headquarter, .

..)

Parameters:

  | tile | North tile of producer
  | w_prod | X extent of producer
  | h_prod | Y extent of producer

Returns:
  : Set of found stations

Definition at line 2975 of file station_cmd.cpp.

References _settings_game, CA_UNMODIFIED, Station::GetCatchmentRadius(), SmallVector< T, S >::Include(), INVALID_TILE, Station::IsBuoy(), IsTileType(), MAX_CATCHMENT, StationSettings::modified_catchment, GameSettings::station, and TileAddWrap().

Referenced by AIIndustry::GetAmountOfStationsAround(), and 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 | X extent of area
  | h | Y extent of area
  | rad | Search radius in addition to given area

Definition at line 503 of file station_cmd.cpp.

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

Referenced by AITileList_IndustryAccepting::AITileList_IndustryAccepting(), DrawStationCoverageAreaText(), AITile::GetCargoAcceptance(), and 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 | Northtile of area
  | w | X extent of the area
  | h | Y extent of the area
  | rad | Search radius in addition to the given area

Definition at line 454 of file station_cmd.cpp.

References _tile_type_procs, TileTypeProcs::get_produced_cargo_proc, GetTileType(), IsTileType(), lengthof, MapSizeX(), MapSizeY(), max(), min(), TileX(), TileXY(), and TileY().

Referenced by AITileList_IndustryProducing::AITileList_IndustryProducing(), DrawStationCoverageAreaText(), and AITile::GetCargoProduction().

bool HasStationInUse | ( | StationID | station,
|  | CompanyID | company |
| ) |  |  |

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

Parameters:

  | station | station ID
  | company | company ID, INVALID_COMPANY to disable the check

Definition at line 2111 of file station_cmd.cpp.

References INVALID_COMPANY.

Referenced by CompanyStationsWindow::BuildStationsList().

void ShowStationViewWindow | ( | StationID | station | ) |

Opens StationViewWindow for given station.

Parameters:

  | station | station which window should be opened

Definition at line 998 of file station_gui.cpp.

void UpdateAllStationVirtCoord | ( |  | ) |

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

Definition at line 395 of file station_cmd.cpp.

References UpdateStationVirtCoord().