namespace XFEEDToolBox.Core.Navigation; /// The original game may remove consumed hops, including the current system, without replanning. public static class NavigationRouteProgress { public static bool SameItinerary(IReadOnlyList 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; } }