namespace XFEEDToolBox.Core.Navigation;
/// <summary>The original game may remove consumed hops, including the current system, without replanning.</summary>
public static class NavigationRouteProgress
{
public static bool SameItinerary(IReadOnlyList<long> planned,NavigationJournalState observed)
{
var actual=observed.Route.Select(point=>point.SystemAddress).ToArray();
if(planned.SequenceEqual(actual))return true;
if(actual.Length==0||actual.Length>planned.Count)return false;
var removed=planned.Count-actual.Length;
if(!planned.Skip(removed).SequenceEqual(actual))return false;
// A suffix may start at the actual current system or its very next hop.
// Removing an unvisited intermediate hop, changing the end, or reordering
// any remaining hop still revokes the itinerary.
return planned[removed]==observed.CurrentSystemAddress
||removed>0&&planned[removed-1]==observed.CurrentSystemAddress;
}
}
namespace XFEEDToolBox.Core.Navigation;
/// <summary>The original game may remove consumed hops, including the current system, without replanning.</summary>
public static class NavigationRouteProgress
{
public static bool SameItinerary(IReadOnlyList<long> planned,NavigationJournalState observed)
{
var actual=observed.Route.Select(point=>point.SystemAddress).ToArray();
if(planned.SequenceEqual(actual))return true;
if(actual.Length==0||actual.Length>planned.Count)return false;
var removed=planned.Count-actual.Length;
if(!planned.Skip(removed).SequenceEqual(actual))return false;
// A suffix may start at the actual current system or its very next hop.
// Removing an unvisited intermediate hop, changing the end, or reordering
// any remaining hop still revokes the itinerary.
return planned[removed]==observed.CurrentSystemAddress
||removed>0&&planned[removed-1]==observed.CurrentSystemAddress;
}
}