XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
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;
    }
}