|
@@ -164,13 +164,13 @@ struct CYapfShip1 : CYapfT<CYapfShip_Typ
|
|
|
/* YAPF type 2 - uses TileIndex/DiagDirection as Node key, allows 90-deg turns */
|
|
|
struct CYapfShip2 : CYapfT<CYapfShip_TypesT<CYapfShip2, CFollowTrackWater , CShipNodeListExitDir > > {};
|
|
|
/* YAPF type 3 - uses TileIndex/Trackdir as Node key, forbids 90-deg turns */
|
|
|
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);
|
|
|
PfnChooseShipTrack pfnChooseShipTrack = CYapfShip2::ChooseShipTrack; // default: ExitDir, allow 90-deg
|
|
|
|
|
|
/* check if non-default YAPF type needed */
|
|
@@ -178,13 +178,13 @@ Trackdir YapfChooseShipTrack(const Vehic
|
|
|
pfnChooseShipTrack = &CYapfShip3::ChooseShipTrack; // Trackdir, forbid 90-deg
|
|
|
} else if (_settings_game.pf.yapf.disable_node_optimization) {
|
|
|
pfnChooseShipTrack = &CYapfShip1::ChooseShipTrack; // Trackdir, allow 90-deg
|
|
|
}
|
|
|
|
|
|
Trackdir td_ret = pfnChooseShipTrack(v, tile, enterdir, tracks);
|
|
|
return td_ret;
|
|
|
return (td_ret != INVALID_TRACKDIR) ? TrackdirToTrack(td_ret) : INVALID_TRACK;
|
|
|
}
|
|
|
|
|
|
/** performance measurement helper */
|
|
|
void *NpfBeginInterval()
|
|
|
{
|
|
|
CPerformanceTimer& perf = *new CPerformanceTimer;
|