Entry point for OpenTTD to YAPF. More...
#include "../../direction_type.h"
#include "../../track_type.h"
#include "../../vehicle_type.h"
#include "../../cargodest_type.h"
#include "../../order_type.h"
#include "../pathfinder_type.h"
Go to the source code of this file.
Functions | |
Track | YapfShipChooseTrack (const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found) |
Finds the best path for given ship using YAPF. | |
Trackdir | YapfRoadVehicleChooseTrack (const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs, bool &path_found) |
Finds the best path for given road vehicle using YAPF. | |
Track | YapfTrainChooseTrack (const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, struct PBSTileInfo *target) |
Finds the best path for given train using YAPF. | |
FindDepotData | YapfRoadVehicleFindNearestDepot (const RoadVehicle *v, int max_penalty) |
Used when user sends road vehicle to the nearest depot or if road vehicle needs servicing using YAPF. | |
FindDepotData | YapfTrainFindNearestDepot (const Train *v, int max_distance) |
Used when user sends train to the nearest depot or if train needs servicing using YAPF. | |
bool | YapfTrainCheckReverse (const Train *v) |
Returns true if it is better to reverse the train before leaving station using YAPF. | |
bool | YapfTrainFindNearestSafeTile (const Train *v, TileIndex tile, Trackdir td, bool override_railtype) |
Try to extend the reserved path of a train to the nearest safe tile using YAPF. | |
RouteLink * | YapfChooseRouteLink (CargoID cid, const StationList *stations, TileIndex src, const TileArea &dest, StationID *start_station, StationID *next_unload, byte flags, bool *found=NULL, OrderID order=INVALID_ORDER, int max_cost=INT_MAX) |
Find the best cargo routing from a station to a destination. |
Entry point for OpenTTD to YAPF.
Definition in file yapf.h.
RouteLink* YapfChooseRouteLink | ( | CargoID | cid, | |
const StationList * | stations, | |||
TileIndex | src, | |||
const TileArea & | dest, | |||
StationID * | start_station, | |||
StationID * | next_unload, | |||
byte | flags, | |||
bool * | found, | |||
OrderID | order, | |||
int | max_cost | |||
) |
Find the best cargo routing from a station to a destination.
cid | Cargo type to route. | |
stations | Set of possible originating stations. | |
dest | Destination tile area. | |
[out] | start_station | Station the best route link originates from. |
[out] | next_unload | Next station the cargo should be unloaded from the vehicle. |
flags | Routing flags of the cargo. | |
[out] | found | True if a link was found. |
order | Order the vehicle arrived at the origin station. | |
max_cost | Maxmimum allowed node cost. |
Definition at line 426 of file yapf_cargo.cpp.
References CYapfFollowRouteLinkT< Types >::ChooseRouteLink().
Referenced by FindRouteLinkForCargo(), and MoveCargoWithDestinationToStationWorker().
Trackdir YapfRoadVehicleChooseTrack | ( | const RoadVehicle * | v, | |
TileIndex | tile, | |||
DiagDirection | enterdir, | |||
TrackdirBits | trackdirs, | |||
bool & | path_found | |||
) |
Finds the best path for given road vehicle using YAPF.
v | the RV that needs to find a path | |
tile | the tile to find the path from (should be next tile the RV is about to enter) | |
enterdir | diagonal direction which the RV will enter this new tile from | |
trackdirs | available trackdirs on the new tile (to choose from) | |
path_found | [out] Whether a path has been found (true) or has been guessed (false) |
Definition at line 481 of file yapf_road.cpp.
References _settings_game, YAPFSettings::disable_node_optimization, FindFirstBit2x64(), INVALID_TRACKDIR, GameSettings::pf, and PathfinderSettings::yapf.
Referenced by RoadFindPathToDest().
FindDepotData YapfRoadVehicleFindNearestDepot | ( | const RoadVehicle * | v, | |
int | max_penalty | |||
) |
Used when user sends road vehicle to the nearest depot or if road vehicle needs servicing using YAPF.
v | vehicle that needs to go to some depot | |
max_penalty | max distance (in pathfinder penalty) from the current vehicle position (used also as optimization - the pathfinder can stop path finding if max_penalty was reached and no depot was seen) |
Definition at line 496 of file yapf_road.cpp.
References _settings_game, FindDepotData::best_length, YAPFSettings::disable_node_optimization, GetTileTrackStatus(), RoadVehicle::GetVehicleTrackdir(), GameSettings::pf, FindDepotData::tile, Vehicle::tile, TrackdirToTrackdirBits(), TrackStatusToTrackdirBits(), TRANSPORT_ROAD, and PathfinderSettings::yapf.
Track YapfShipChooseTrack | ( | const Ship * | v, | |
TileIndex | tile, | |||
DiagDirection | enterdir, | |||
TrackBits | tracks, | |||
bool & | path_found | |||
) |
Finds the best path for given ship using YAPF.
v | the ship that needs to find a path | |
tile | the tile to find the path from (should be next tile the ship is about to enter) | |
enterdir | diagonal direction which the ship will enter this new tile from | |
tracks | available tracks on the new tile (to choose from) | |
path_found | [out] Whether a path has been found (true) or has been guessed (false) |
Definition at line 178 of file yapf_ship.cpp.
References _settings_game, YAPFSettings::disable_node_optimization, PathfinderSettings::forbid_90_deg, INVALID_TRACK, INVALID_TRACKDIR, GameSettings::pf, TrackdirToTrack(), and PathfinderSettings::yapf.
Referenced by ChooseShipTrack().
bool YapfTrainCheckReverse | ( | const Train * | v | ) |
Returns true if it is better to reverse the train before leaving station using YAPF.
v | the train leaving the station |
Definition at line 549 of file yapf_rail.cpp.
References _settings_game, DistanceManhattan(), PathfinderSettings::forbid_90_deg, GetOtherTunnelBridgeEnd(), GetTunnelBridgeDirection(), Train::GetVehicleTrackdir(), SpecializedVehicle< T, Type >::Last(), GameSettings::pf, ReverseTrackdir(), Vehicle::tile, TileVirtXY(), TRACK_BIT_WORMHOLE, TrackdirToExitdir(), Vehicle::x_pos, Vehicle::y_pos, and YAPF_TILE_LENGTH.
Track YapfTrainChooseTrack | ( | const Train * | v, | |
TileIndex | tile, | |||
DiagDirection | enterdir, | |||
TrackBits | tracks, | |||
bool & | path_found, | |||
bool | reserve_track, | |||
struct PBSTileInfo * | target | |||
) |
Finds the best path for given train using YAPF.
v | the train that needs to find a path | |
tile | the tile to find the path from (should be next tile the train is about to enter) | |
enterdir | diagonal direction which the RV will enter this new tile from | |
tracks | available trackdirs on the new tile (to choose from) | |
path_found | [out] Whether a path has been found (true) or has been guessed (false) | |
reserve_track | indicates whether YAPF should try to reserve the found path | |
target | [out] the target tile of the reservation, free is set to true if path was reserved |
Definition at line 534 of file yapf_rail.cpp.
References _settings_game, FindFirstTrack(), PathfinderSettings::forbid_90_deg, INVALID_TRACKDIR, GameSettings::pf, and TrackdirToTrack().
Referenced by DoTrainPathfind().
FindDepotData YapfTrainFindNearestDepot | ( | const Train * | v, | |
int | max_distance | |||
) |
Used when user sends train to the nearest depot or if train needs servicing using YAPF.
v | train that needs to go to some depot | |
max_distance | max distance (int pathfinder penalty) from the current train position (used also as optimization - the pathfinder can stop path finding if max_penalty was reached and no depot was seen) |
Definition at line 608 of file yapf_rail.cpp.
References _settings_game, FindDepotData::best_length, FollowTrainReservation(), PathfinderSettings::forbid_90_deg, Train::GetVehicleTrackdir(), SpecializedVehicle< T, Type >::Last(), GameSettings::pf, FindDepotData::reverse, ReverseTrackdir(), FindDepotData::tile, PBSTileInfo::tile, Vehicle::tile, PBSTileInfo::trackdir, and YAPF_INFINITE_PENALTY.
Referenced by FindClosestTrainDepot().
bool YapfTrainFindNearestSafeTile | ( | const Train * | v, | |
TileIndex | tile, | |||
Trackdir | td, | |||
bool | override_railtype | |||
) |
Try to extend the reserved path of a train to the nearest safe tile using YAPF.
v | The train that needs to find a safe tile. | |
tile | Last tile of the current reserved path. | |
td | Last trackdir of the current reserved path. | |
override_railtype | Should all physically compatible railtypes be searched, even if the vehicle can't run on them on its own? |
Definition at line 631 of file yapf_rail.cpp.
References _settings_game, PathfinderSettings::forbid_90_deg, and GameSettings::pf.
Referenced by TryReserveSafeTrack().