diff options
author | rubidium <rubidium@openttd.org> | 2009-12-01 23:56:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-01 23:56:04 +0000 |
commit | 76fe20cdccd68679f4681e3f378b7695d161e8a8 (patch) | |
tree | 2bc31ade4605acc0304669e3bc3353d7beca0d3f /src/pathfinder/yapf | |
parent | 291f6490c65bd88067db472a915b4ea29cc5741a (diff) | |
download | openttd-76fe20cdccd68679f4681e3f378b7695d161e8a8.tar.xz |
(svn r18367) -Codechange: unify the ship pathfinder 'calls'
Diffstat (limited to 'src/pathfinder/yapf')
-rw-r--r-- | src/pathfinder/yapf/yapf.h | 9 | ||||
-rw-r--r-- | src/pathfinder/yapf/yapf.hpp | 1 | ||||
-rw-r--r-- | src/pathfinder/yapf/yapf_ship.cpp | 4 |
3 files changed, 6 insertions, 8 deletions
diff --git a/src/pathfinder/yapf/yapf.h b/src/pathfinder/yapf/yapf.h index d55a4f372..c0c0cf087 100644 --- a/src/pathfinder/yapf/yapf.h +++ b/src/pathfinder/yapf/yapf.h @@ -12,20 +12,17 @@ #ifndef YAPF_H #define YAPF_H -#include "../../debug.h" -#include "../../depot_type.h" #include "../../direction_type.h" #include "../../station_type.h" -#include "../../pbs.h" /** Finds the best path for given ship. * @param v the ship that needs to find a path * @param tile the tile to find the path from (should be next tile the ship is about to enter) * @param enterdir diagonal direction which the ship will enter this new tile from * @param tracks available tracks on the new tile (to choose from) - * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found + * @return the best trackdir for next turn or INVALID_TRACK if the path could not be found */ -Trackdir YapfChooseShipTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks); +Track YapfChooseShipTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks); /** Finds the best path for given road vehicle. * @param v the RV that needs to find a path @@ -45,7 +42,7 @@ Trackdir YapfChooseRoadTrack(const Vehicle *v, TileIndex tile, DiagDirection ent * @param target [out] the target tile of the reservation, free is set to true if path was reserved * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found */ -Trackdir YapfChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found, bool reserve_track, PBSTileInfo *target); +Trackdir YapfChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found, bool reserve_track, struct PBSTileInfo *target); /** Used by RV multistop feature to find the nearest road stop that has a free slot. * @param v RV (its current tile will be the origin) diff --git a/src/pathfinder/yapf/yapf.hpp b/src/pathfinder/yapf/yapf.hpp index a353902c5..a8e887a13 100644 --- a/src/pathfinder/yapf/yapf.hpp +++ b/src/pathfinder/yapf/yapf.hpp @@ -24,6 +24,7 @@ #include "../../landscape.h" #include "yapf.h" #include "../pathfinder_func.h" +#include "../../pbs.h" #include "../../waypoint_base.h" #include "../../debug.h" #include "../../settings_type.h" diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp index 3ae152bd6..f0de614ac 100644 --- a/src/pathfinder/yapf/yapf_ship.cpp +++ b/src/pathfinder/yapf/yapf_ship.cpp @@ -167,7 +167,7 @@ struct CYapfShip2 : CYapfT<CYapfShip_TypesT<CYapfShip2, CFollowTrackWater , C struct CYapfShip3 : CYapfT<CYapfShip_TypesT<CYapfShip3, CFollowTrackWaterNo90, CShipNodeListTrackDir> > {}; /** Ship controller helper - path finder invoker */ -Trackdir YapfChooseShipTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks) +Track YapfChooseShipTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks) { /* default is YAPF type 2 */ typedef Trackdir (*PfnChooseShipTrack)(const Vehicle*, TileIndex, DiagDirection, TrackBits); @@ -181,7 +181,7 @@ Trackdir YapfChooseShipTrack(const Vehicle *v, TileIndex tile, DiagDirection ent } Trackdir td_ret = pfnChooseShipTrack(v, tile, enterdir, tracks); - return td_ret; + return (td_ret != INVALID_TRACKDIR) ? TrackdirToTrack(td_ret) : INVALID_TRACK; } /** performance measurement helper */ |