18 |
18 |
19 /** Finds the best path for given road vehicle. |
19 /** Finds the best path for given road vehicle. |
20 * @param v the RV that needs to find a path |
20 * @param v the RV that needs to find a path |
21 * @param tile the tile to find the path from (should be next tile the RV is about to enter) |
21 * @param tile the tile to find the path from (should be next tile the RV is about to enter) |
22 * @param enterdir diagonal direction which the RV will enter this new tile from |
22 * @param enterdir diagonal direction which the RV will enter this new tile from |
23 * @param tracks available tracks on the new tile (to choose from) |
|
24 * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found |
23 * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found |
25 */ |
24 */ |
26 Trackdir YapfChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir); |
25 Trackdir YapfChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir); |
27 |
26 |
28 /** Finds the best path for given train. |
27 /** Finds the best path for given train. |
29 * @param v the train that needs to find a path |
28 * @param v the train that needs to find a path |
30 * @param tile the tile to find the path from (should be next tile the train is about to enter) |
29 * @param tile the tile to find the path from (should be next tile the train is about to enter) |
31 * @param enterdir diagonal direction which the RV will enter this new tile from |
30 * @param enterdir diagonal direction which the RV will enter this new tile from |
32 * @param trackdirs available trackdirs on the new tile (to choose from) |
31 * @param tracks available trackdirs on the new tile (to choose from) |
33 * @param no_path_found [out] true is returned if no path can be found (returned Trackdir is only a 'guess') |
32 * @param path_not_found [out] true is returned if no path can be found (returned Trackdir is only a 'guess') |
34 * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found |
33 * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found |
35 */ |
34 */ |
36 Trackdir YapfChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found); |
35 Trackdir YapfChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found); |
37 |
36 |
38 /** Used by RV multistop feature to find the nearest road stop that has a free slot. |
37 /** Used by RV multistop feature to find the nearest road stop that has a free slot. |
46 * Returns the nearest depot (or NULL if depot was not found). |
45 * Returns the nearest depot (or NULL if depot was not found). |
47 */ |
46 */ |
48 Depot* YapfFindNearestRoadDepot(const Vehicle *v); |
47 Depot* YapfFindNearestRoadDepot(const Vehicle *v); |
49 |
48 |
50 /** Used when user sends train to the nearest depot or if train needs servicing. |
49 /** Used when user sends train to the nearest depot or if train needs servicing. |
51 * @v train that needs to go to some depot |
50 * @param v train that needs to go to some depot |
52 * @max_distance max distance (number of track tiles) from the current train position |
51 * @param max_distance max distance (number of track tiles) from the current train position |
53 * (used also as optimization - the pathfinder can stop path finding if max_distance |
52 * (used also as optimization - the pathfinder can stop path finding if max_distance |
54 * was reached and no depot was seen) |
53 * was reached and no depot was seen) |
55 * @reverse_penalty penalty that should be added for the path that requires reversing the train first |
54 * @param reverse_penalty penalty that should be added for the path that requires reversing the train first |
56 * @depot_tile receives the depot tile if depot was found |
55 * @param depot_tile receives the depot tile if depot was found |
57 * @reversed receives true if train needs to reversed first |
56 * @param reversed receives true if train needs to reversed first |
58 * @return the true if depot was found. |
57 * @return the true if depot was found. |
59 */ |
58 */ |
60 bool YapfFindNearestRailDepotTwoWay(Vehicle *v, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed); |
59 bool YapfFindNearestRailDepotTwoWay(Vehicle *v, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed); |
61 |
60 |
62 /** Returns true if it is better to reverse the train before leaving station */ |
61 /** Returns true if it is better to reverse the train before leaving station */ |