mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Codefix: Remove no-longer used ship special-case. (#12192)
This special-case has not been triggered since multi-tile docks were introduced.
This commit is contained in:
parent
cff48c0f63
commit
b2ca6e1ac8
@ -22,11 +22,10 @@
|
|||||||
* @param v the ship that needs to find a path
|
* @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 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 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)
|
* @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
|
* @return the best trackdir for next turn or INVALID_TRACK if the path could not be found
|
||||||
*/
|
*/
|
||||||
Track YapfShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, ShipPathCache &path_cache);
|
Track YapfShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, bool &path_found, ShipPathCache &path_cache);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if it is better to reverse the ship before leaving depot using YAPF.
|
* Returns true if it is better to reverse the ship before leaving depot using YAPF.
|
||||||
|
@ -203,20 +203,8 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Trackdir ChooseShipTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, ShipPathCache &path_cache)
|
static Trackdir ChooseShipTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, bool &path_found, ShipPathCache &path_cache)
|
||||||
{
|
{
|
||||||
/* Handle special case - when next tile is destination tile. */
|
|
||||||
if (tile == v->dest_tile) {
|
|
||||||
/* Convert tracks to trackdirs */
|
|
||||||
TrackdirBits trackdirs = TrackBitsToTrackdirBits(tracks);
|
|
||||||
/* Limit to trackdirs reachable from enterdir. */
|
|
||||||
trackdirs &= DiagdirReachesTrackdirs(enterdir);
|
|
||||||
|
|
||||||
/* use vehicle's current direction if that's possible, otherwise use first usable one. */
|
|
||||||
Trackdir veh_dir = v->GetVehicleTrackdir();
|
|
||||||
return (HasTrackdir(trackdirs, veh_dir)) ? veh_dir : (Trackdir)FindFirstBit(trackdirs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move back to the old tile/trackdir (where ship is coming from). */
|
/* Move back to the old tile/trackdir (where ship is coming from). */
|
||||||
const TileIndex src_tile = TileAddByDiagDir(tile, ReverseDiagDir(enterdir));
|
const TileIndex src_tile = TileAddByDiagDir(tile, ReverseDiagDir(enterdir));
|
||||||
const Trackdir trackdir = v->GetVehicleTrackdir();
|
const Trackdir trackdir = v->GetVehicleTrackdir();
|
||||||
@ -445,9 +433,9 @@ struct CYapfShip : CYapfT<CYapfShip_TypesT<CYapfShip, CFollowTrackWater, CShipNo
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Ship controller helper - path finder invoker. */
|
/** Ship controller helper - path finder invoker. */
|
||||||
Track YapfShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, ShipPathCache &path_cache)
|
Track YapfShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, bool &path_found, ShipPathCache &path_cache)
|
||||||
{
|
{
|
||||||
Trackdir td_ret = CYapfShip::ChooseShipTrack(v, tile, enterdir, tracks, path_found, path_cache);
|
Trackdir td_ret = CYapfShip::ChooseShipTrack(v, tile, enterdir, path_found, path_cache);
|
||||||
return (td_ret != INVALID_TRACKDIR) ? TrackdirToTrack(td_ret) : INVALID_TRACK;
|
return (td_ret != INVALID_TRACKDIR) ? TrackdirToTrack(td_ret) : INVALID_TRACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ static Track ChooseShipTrack(Ship *v, TileIndex tile, DiagDirection enterdir, Tr
|
|||||||
|
|
||||||
switch (_settings_game.pf.pathfinder_for_ships) {
|
switch (_settings_game.pf.pathfinder_for_ships) {
|
||||||
case VPF_NPF: track = NPFShipChooseTrack(v, path_found); break;
|
case VPF_NPF: track = NPFShipChooseTrack(v, path_found); break;
|
||||||
case VPF_YAPF: track = YapfShipChooseTrack(v, tile, enterdir, tracks, path_found, v->path); break;
|
case VPF_YAPF: track = YapfShipChooseTrack(v, tile, enterdir, path_found, v->path); break;
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user