示例#1
0
        // used by historylist directly for a single update during play, in foreground..  Also used by above.. so can be either in fore/back
        public bool AddScanToBestSystem(JournalScan je, int startindex, List <HistoryEntry> hl, out HistoryEntry he, out JournalLocOrJump jl)
        {
            for (int j = startindex; j >= 0; j--)
            {
                he = hl[j];

                if (he.IsLocOrJump)
                {
                    jl = (JournalLocOrJump)he.journalEntry;
                    string designation = GetBodyDesignation(je, he.System.Name);

                    if (je.IsStarNameRelated(he.System.Name, designation))       // if its part of the name, use it
                    {
                        je.BodyDesignation = designation;
                        return(Process(je, he.System, true));
                    }
                    else if (jl != null && je.IsStarNameRelated(jl.StarSystem, designation))
                    {
                        // Ignore scans where the system name has changed
                        return(false);
                    }
                }
            }

            jl = null;
            he = null;

            je.BodyDesignation = GetBodyDesignation(je, hl[startindex].System.Name);
            return(Process(je, hl[startindex].System, true));         // no relationship, add..
        }
示例#2
0
        public bool AddScanToBestSystem(JournalScan je, int startindex, List <HistoryEntry> hl, out HistoryEntry he, out JournalLocOrJump jl)
        {
            he = null;
            jl = null;

            if (je?.BodyName == null)
            {
                return(false);
            }

            // go thru the list of history entries looking for a Loc

            for (int j = startindex; j >= 0; j--)   // same as FindBestSystem
            {
                he = hl[j];

                if (he.IsLocOrJump)
                {
                    jl = (JournalLocOrJump)he.journalEntry;

                    // get the body designation, given the je/system name

                    string designation = BodyDesignations.GetBodyDesignation(je, he.System.Name);
                    System.Diagnostics.Debug.Assert(designation != null);

                    // either the name/sys address matches, or the designation matches the star of the system name
                    if (je.IsStarNameRelated(he.System.Name, he.System.SystemAddress, designation))
                    {
                        je.BodyDesignation = designation;
                        return(ProcessJournalScan(je, he.System, true));
                    }
                    else if (jl.StarSystem != null && je.IsStarNameRelated(jl.StarSystem, jl.SystemAddress, designation)) // if we have a starsystem name, and its related, its a rename, ignore it
                    {
                        System.Diagnostics.Trace.WriteLine($"Rejecting body {designation} ({je.BodyName}) in system {he.System.Name} => {jl.StarSystem} due to system rename");
                        return(false);
                    }
                }
            }

            je.BodyDesignation = BodyDesignations.GetBodyDesignation(je, hl[startindex].System.Name);
            return(ProcessJournalScan(je, hl[startindex].System, true));         // no relationship, add..
        }
        // used by historylist directly for a single update during play, in foreground..  Also used by above.. so can be either in fore/back
        public bool AddScanToBestSystem(JournalScan je, int startindex, List <HistoryEntry> hl, out HistoryEntry he, out JournalLocOrJump jl)
        {
            if (je?.BodyName == null)
            {
                he = null;
                jl = null;
                return(false);
            }

            for (int j = startindex; j >= 0; j--)
            {
                he = hl[j];

                if (he.IsLocOrJump)
                {
                    jl = (JournalLocOrJump)he.journalEntry;
                    string designation = GetBodyDesignation(je, he.System.Name);

                    if (je.IsStarNameRelated(he.System.Name, designation, he.System.SystemAddress))       // if its part of the name, use it
                    {
                        je.BodyDesignation = designation;
                        return(ProcessJournalScan(je, he.System, true));
                    }
                    else if (jl != null && je.IsStarNameRelated(jl.StarSystem, designation, jl.SystemAddress))
                    {
                        // Ignore scans where the system name has changed
                        System.Diagnostics.Trace.WriteLine($"Rejecting body {designation} ({je.BodyName}) in system {he.System.Name} => {jl.StarSystem} due to system rename");
                        return(false);
                    }
                }
            }

            jl = null;
            he = null;

            je.BodyDesignation = GetBodyDesignation(je, hl[startindex].System.Name);
            return(ProcessJournalScan(je, hl[startindex].System, true));         // no relationship, add..
        }