# pathfinder_func.h File Reference

General functions related to pathfinders. More...

`#include "../station_base.h"`
`#include "../waypoint_base.h"`

Go to the source code of this file.

## Functions
static TileIndex | CalcClosestStationTile (StationID station, TileIndex tile, StationType station_type)
| Calculates the tile of given station that is closest to a given tile for this we assume the station is a rectangle, as defined by its tile are (st->train_station).

## Detailed Description

General functions related to pathfinders.

Definition in file pathfinder_func.h.

## Function Documentation

static TileIndex CalcClosestStationTile | ( | StationID | station,
|  | TileIndex | tile,
|  | StationType | station_type |
| ) |  |  | `[inline, static]`

Calculates the tile of given station that is closest to a given tile for this we assume the station is a rectangle, as defined by its tile are (st->train_station).

Parameters:

  | station | The station to calculate the distance to
  | tile | The tile from where to calculate the distance
  | station_type | the station type to get the closest tile of

Returns:
  The closest station tile to the given tile.

Definition at line 27 of file pathfinder_func.h.

References ClampU(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::Get(), BaseStation::GetTileArea(), TileArea::h, INVALID_TILE, TileArea::tile, TileX(), TileXY(), TileY(), TileArea::w, and BaseStation::xy.