summaryrefslogtreecommitdiff
path: root/src/npf.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-02 22:52:22 +0000
committerrubidium <rubidium@openttd.org>2008-08-02 22:52:22 +0000
commitcd041b6944a392dedeef5fa8caa07c340200d9d7 (patch)
tree148f80b018662589c906dbe6416b5bf662508cd3 /src/npf.h
parent773f19da0505d59f31ca7f22afe206ac89deb7af (diff)
downloadopenttd-cd041b6944a392dedeef5fa8caa07c340200d9d7.tar.xz
(svn r13946) -Add [YAPP]: Implement track reserving for NPF as well. (michi_cc)
Diffstat (limited to 'src/npf.h')
-rw-r--r--src/npf.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/npf.h b/src/npf.h
index 5a70b6be0..d1429b35a 100644
--- a/src/npf.h
+++ b/src/npf.h
@@ -45,6 +45,8 @@ enum {
struct NPFFindStationOrTileData {
TileIndex dest_coords; ///< An indication of where the station is, for heuristic purposes, or the target tile
StationID station_index; ///< station index we're heading for, or INVALID_STATION when we're heading for a tile
+ bool reserve_path; ///< Indicates whether the found path should be reserved
+ const Vehicle* v; ///< The vehicle we are pathfinding for
};
/* Indices into AyStar.userdata[] */
@@ -67,6 +69,7 @@ enum NPFNodeFlag {
NPF_FLAG_REVERSE, ///< Used to mark that this node was reached from the second start node, if applicable
NPF_FLAG_LAST_SIGNAL_RED, ///< Used to mark that the last signal on this path was red
NPF_FLAG_IGNORE_START_TILE, ///< Used to mark that the start tile is invalid, and searching should start from the second tile on
+ NPF_FLAG_TARGET_RESERVED, ///< Used to mark that the possible reservation target is already reserved
};
/* Meant to be stored in AyStar.userpath */
@@ -75,6 +78,7 @@ struct NPFFoundTargetData {
uint best_path_dist; ///< The shortest path. Is (uint)-1 if no path is found
Trackdir best_trackdir; ///< The trackdir that leads to the shortest path/closest birds dist
AyStarNode node; ///< The node within the target the search led us to
+ bool res_okay; ///< True if a path reservation could be made
};
/* These functions below are _not_ re-entrant, in favor of speed! */
@@ -105,7 +109,7 @@ NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, Trackdir t
* of choices and accurate heuristics, such as water. */
NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, TransportType type, uint sub_type, Owner owner, RailTypes railtypes);
-void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v);
+void NPFFillWithOrderData(NPFFindStationOrTileData *fstd, Vehicle *v, bool reserve_path = false);
/*