OpenTTD Source 20241224-master-gf74b0cf984
|
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) | |
TrackdirBits | GetTrackdirBitsForRoad (TileIndex tile, RoadTramType rtt) |
Wrapper around GetTileTrackStatus() and TrackStatusToTrackdirBits(), as for single tram bits GetTileTrackStatus() returns 0. | |
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 ClampU(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::Get(), BaseStation::GetTileArea(), OrthogonalTileArea::h, INVALID_TILE, OrthogonalTileArea::tile, TileX(), TileXY(), 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 GetRoadBits(), GetTileTrackStatus(), IsNormalRoadTile(), ROAD_NE, ROAD_NW, ROAD_SE, ROAD_SW, TRACKDIR_BIT_NONE, TRACKDIR_BIT_X_NE, TRACKDIR_BIT_X_SW, TRACKDIR_BIT_Y_NW, TRACKDIR_BIT_Y_SE, TrackStatusToTrackdirBits(), and TRANSPORT_ROAD.
Referenced by CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::QueryNewTileTrackStatus(), CYapfFollowRoadT< Types >::SetOriginFromVehiclePos(), and YapfRoadVehicleFindNearestDepot().