diff options
-rw-r--r-- | src/pathfinder/npf/npf.cpp | 6 | ||||
-rw-r--r-- | src/pathfinder/npf/npf_func.h | 8 | ||||
-rw-r--r-- | src/ship_cmd.cpp | 2 | ||||
-rw-r--r-- | src/train_cmd.cpp | 2 |
4 files changed, 7 insertions, 11 deletions
diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 9535ac063..c9195c5aa 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -1154,7 +1154,7 @@ Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDir /*** Ships ***/ -Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found) +Track NPFShipChooseTrack(const Ship *v, TrackBits tracks, bool &path_found) { NPFFindStationOrTileData fstd; Trackdir trackdir = v->GetVehicleTrackdir(); @@ -1163,7 +1163,7 @@ Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, NPFFillWithOrderData(&fstd, v); AyStarUserData user = { v->owner, TRANSPORT_WATER, INVALID_RAILTYPES, ROADTYPES_NONE }; - NPFFoundTargetData ftd = NPFRouteToStationOrTile(tile - TileOffsByDiagDir(enterdir), trackdir, true, &fstd, &user); + NPFFoundTargetData ftd = NPFRouteToStationOrTile(v->tile, trackdir, true, &fstd, &user); /* If ftd.best_bird_dist is 0, we found our target and ftd.best_trackdir contains * the direction we need to take to get there, if ftd.best_bird_dist is not 0, @@ -1256,7 +1256,7 @@ bool NPFTrainCheckReverse(const Train *v) return ftd.best_bird_dist == 0 && NPFGetFlag(&ftd.node, NPF_FLAG_REVERSE); } -Track NPFTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, struct PBSTileInfo *target) +Track NPFTrainChooseTrack(const Train *v, TrackBits tracks, bool &path_found, bool reserve_track, struct PBSTileInfo *target) { NPFFindStationOrTileData fstd; NPFFillWithOrderData(&fstd, v, reserve_track); diff --git a/src/pathfinder/npf/npf_func.h b/src/pathfinder/npf/npf_func.h index 6507f4ec5..366727f9c 100644 --- a/src/pathfinder/npf/npf_func.h +++ b/src/pathfinder/npf/npf_func.h @@ -41,13 +41,11 @@ Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDir /** * Finds the best path for given ship using NPF. * @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) * @param path_found [out] Whether a path has been found (true) or has been guessed (false) * @return the best trackdir for next turn or INVALID_TRACK if the path could not be found */ -Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found); +Track NPFShipChooseTrack(const Ship *v, TrackBits tracks, bool &path_found); /** * Returns true if it is better to reverse the ship before leaving depot using NPF. @@ -87,14 +85,12 @@ bool NPFTrainCheckReverse(const Train *v); /** * Finds the best path for given train using NPF. * @param v the train that needs to find a path - * @param tile the tile to find the path from (should be next tile the train is about to enter) - * @param enterdir diagonal direction which the RV will enter this new tile from * @param tracks available trackdirs on the new tile (to choose from) * @param path_found [out] Whether a path has been found (true) or has been guessed (false) * @param reserve_track indicates whether YAPF should try to reserve the found path * @param target [out] the target tile of the reservation, free is set to true if path was reserved * @return the best track for next turn */ -Track NPFTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, struct PBSTileInfo *target); +Track NPFTrainChooseTrack(const Train *v, TrackBits tracks, bool &path_found, bool reserve_track, struct PBSTileInfo *target); #endif /* NPF_FUNC_H */ diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index ec0d43089..56949ddf5 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -491,7 +491,7 @@ static Track ChooseShipTrack(Ship *v, TileIndex tile, DiagDirection enterdir, Tr switch (_settings_game.pf.pathfinder_for_ships) { case VPF_OPF: track = OPFShipChooseTrack(v, tile, enterdir, tracks, path_found); break; - case VPF_NPF: track = NPFShipChooseTrack(v, tile, enterdir, tracks, path_found); break; + case VPF_NPF: track = NPFShipChooseTrack(v, tracks, path_found); break; case VPF_YAPF: track = YapfShipChooseTrack(v, tile, enterdir, tracks, path_found, v->path); break; default: NOT_REACHED(); } diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 01aa946ed..5e715a373 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2313,7 +2313,7 @@ static const byte _initial_tile_subcoord[6][4][3] = { static Track DoTrainPathfind(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool do_track_reservation, PBSTileInfo *dest) { switch (_settings_game.pf.pathfinder_for_trains) { - case VPF_NPF: return NPFTrainChooseTrack(v, tile, enterdir, tracks, path_found, do_track_reservation, dest); + case VPF_NPF: return NPFTrainChooseTrack(v, tracks, path_found, do_track_reservation, dest); case VPF_YAPF: return YapfTrainChooseTrack(v, tile, enterdir, tracks, path_found, do_track_reservation, dest); default: NOT_REACHED(); |