#include "../stdafx.h"
#include "yapf.hpp"
#include "yapf_node_rail.hpp"
#include "yapf_costrail.hpp"
#include "yapf_destrail.hpp"
#include "../vehicle_func.h"
#include "../functions.h"
Go to the source code of this file.
Data Structures | |
class | CYapfReserveTrack< Types > |
class | CYapfFollowAnyDepotRailT< Types > |
class | CYapfFollowAnySafeTileRailT< Types > |
class | CYapfFollowRailT< Types > |
struct | CYapfRail_TypesT< Tpf_, Ttrack_follower, Tnode_list, TdestinationT, TfollowT > |
struct | CYapfRail1 |
struct | CYapfRail2 |
struct | CYapfAnyDepotRail1 |
struct | CYapfAnyDepotRail2 |
struct | CYapfAnySafeTileRail1 |
struct | CYapfAnySafeTileRail2 |
Defines | |
#define | DEBUG_YAPF_CACHE 0 |
Functions | |
Trackdir | YapfChooseRailTrack (const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found, bool reserve_track, PBSTileInfo *target) |
Finds the best path for given train. | |
bool | YapfCheckReverseTrain (const Vehicle *v) |
Returns true if it is better to reverse the train before leaving station. | |
bool | YapfFindNearestRailDepotTwoWay (const Vehicle *v, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed) |
Used when user sends train to the nearest depot or if train needs servicing. | |
bool | YapfRailFindNearestSafeTile (const Vehicle *v, TileIndex tile, Trackdir td, bool override_railtype) |
Try to extend the reserved path of a train to the nearest safe tile. | |
void | YapfNotifyTrackLayoutChange (TileIndex tile, Track track) |
Use this function to notify YAPF that track layout (or signal configuration) has change. | |
Variables | |
int | _total_pf_time_us = 0 |
Definition in file yapf_rail.cpp.
Trackdir YapfChooseRailTrack | ( | const Vehicle * | v, | |
TileIndex | tile, | |||
DiagDirection | enterdir, | |||
TrackBits | tracks, | |||
bool * | path_not_found, | |||
bool | reserve_track, | |||
PBSTileInfo * | target | |||
) |
Finds the best path for given train.
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_not_found | [out] true is returned if no path can be found (returned Trackdir is only a 'guess') | |
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 520 of file yapf_rail.cpp.
References _settings_game, PathfinderSettings::forbid_90_deg, and GameSettings::pf.
Referenced by DoTrainPathfind().
bool YapfFindNearestRailDepotTwoWay | ( | const Vehicle * | v, | |
int | max_distance, | |||
int | reverse_penalty, | |||
TileIndex * | depot_tile, | |||
bool * | reversed | |||
) |
Used when user sends train to the nearest depot or if train needs servicing.
v | train that needs to go to some depot | |
max_distance | max distance (number of track tiles) from the current train position (used also as optimization - the pathfinder can stop path finding if max_distance was reached and no depot was seen) | |
reverse_penalty | penalty that should be added for the path that requires reversing the train first | |
depot_tile | receives the depot tile if depot was found | |
reversed | receives true if train needs to reversed first |
Definition at line 596 of file yapf_rail.cpp.
References _settings_game, FollowTrainReservation(), PathfinderSettings::forbid_90_deg, GetVehicleTrackdir(), INVALID_TILE, GameSettings::pf, ReverseTrackdir(), PBSTileInfo::tile, and PBSTileInfo::trackdir.
Referenced by FindClosestTrainDepot().
bool YapfRailFindNearestSafeTile | ( | const Vehicle * | v, | |
TileIndex | tile, | |||
Trackdir | td, | |||
bool | override_railtype | |||
) |
Try to extend the reserved path of a train to the nearest safe tile.
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 compabtible railtypes be searched, even if the vehicle can't on them on it own? |
Definition at line 619 of file yapf_rail.cpp.
References _settings_game, PathfinderSettings::forbid_90_deg, and GameSettings::pf.
Referenced by TryReserveSafeTrack().