OpenTTD Source
20241108-master-g80f628063a
|
General functions related to pathfinders. More...
Go to the source code of this file.
Functions | |
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) More... | |
TrackdirBits | GetTrackdirBitsForRoad (TileIndex tile, RoadTramType rtt) |
Wrapper around GetTileTrackStatus() and TrackStatusToTrackdirBits(), as for single tram bits GetTileTrackStatus() returns 0. More... | |
General functions related to pathfinders.
Definition in file pathfinder_func.h.
|
inline |
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)
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 |
Definition at line 25 of file pathfinder_func.h.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::Get(), BaseStation::GetTileArea(), OrthogonalTileArea::h, INVALID_TILE, OrthogonalTileArea::tile, TileX(), TileY(), OrthogonalTileArea::w, and BaseStation::xy.
|
inline |
Wrapper around GetTileTrackStatus() and TrackStatusToTrackdirBits(), as for single tram bits GetTileTrackStatus() returns 0.
The reason for this is that there are no half-tile TrackBits in OpenTTD. This tile, however, is a valid tile for trams, one on which they can reverse safely. To "fix" this, pretend that if we are on a half-tile, we are in fact on a straight tram track tile. CFollowTrackT will make sure the pathfinders cannot exit on the wrong side and allows reversing on such tiles.
Definition at line 60 of file pathfinder_func.h.
References GetTileTrackStatus(), TrackStatusToTrackdirBits(), and TRANSPORT_ROAD.
Referenced by CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::QueryNewTileTrackStatus(), CYapfFollowRoadT< Types >::SetOriginFromVehiclePos(), and YapfRoadVehicleFindNearestDepot().