Ejemplo n.º 1
0
        public void Missions(JournalMissions m)
        {
            List <string> toresurrect = new List <string>();

            foreach (var mi in m.ActiveMissions)
            {
                string kn = MissionList.Key(mi.MissionID, mi.Name);

                if (missionlist.Missions.ContainsKey(kn))
                {
                    MissionState ms = missionlist.Missions[kn];

                    if (ms.State == MissionState.StateTypes.Died)   // if marked died...
                    {
                        System.Diagnostics.Debug.WriteLine("Missions in active list but marked died" + kn);
                        toresurrect.Add(kn);
                    }
                }
            }

            if (toresurrect.Count > 0)                      // if any..
            {
                missionlist = new MissionList(missionlist); // shallow copy
                missionlist.Resurrect(toresurrect);
            }
        }
Ejemplo n.º 2
0
 public void Redirected(JournalMissionRedirected m)
 {
     if (missionlist.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so
     {
         missionlist = new MissionList(missionlist);           // shallow copy
         missionlist.Redirected(m);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Missions: Unknown " + MissionList.Key(m));
     }
 }
Ejemplo n.º 3
0
 public void Accepted(JournalMissionAccepted m, ISystem sys, string body)
 {
     if (!missionlist.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so
     {
         missionlist = new MissionList(missionlist);            // shallow copy
         missionlist.Add(m, sys, body);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Missions: Duplicate " + MissionList.Key(m));
     }
 }
Ejemplo n.º 4
0
 public void Failed(JournalMissionFailed m)
 {
     if (current.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so
     {
         current = new MissionList(current);               // shallow copy
         current.Failed(m);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Missions: Unknown " + MissionList.Key(m));
     }
 }
Ejemplo n.º 5
0
 public void Failed(JournalMissionFailed m)
 {
     if (missionlist.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so
     {
         missionlist = new MissionList(missionlist);           // shallow copy
         missionlist.Failed(m);
         // System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Missions Failed " + MissionList.Key(m));
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Missions: Unknown " + MissionList.Key(m));
     }
 }
Ejemplo n.º 6
0
        public void CargoDepot(JournalCargoDepot m)
        {
            string key = missionlist.GetExistingKeyFromID(m.MissionId);

            if (key != null)
            {
                missionlist = new MissionList(missionlist);     // shallow copy
                missionlist.CargoDepot(key, m);
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Missions: Unknown " + m.MissionId);
            }
        }
Ejemplo n.º 7
0
 public void Died(DateTime diedtime)
 {
     missionlist = new MissionList(missionlist);     // shallow copy
     missionlist.Died(diedtime);
 }
Ejemplo n.º 8
0
 public MissionListAccumulator()
 {
     missionlist = new MissionList();
 }
Ejemplo n.º 9
0
 public MissionList(MissionList other)
 {
     Missions = new Dictionary <string, MissionState>(other.Missions);
 }
Ejemplo n.º 10
0
 public void UpdateMissionList(MissionList ml)
 {
     MissionList = ml;
 }
Ejemplo n.º 11
0
 public MissionListAccumulator()
 {
     current = new MissionList();
 }
Ejemplo n.º 12
0
        public void Missions(JournalMissions m)
        {
            List <string>    toresurrect = new List <string>();
            HashSet <string> active      = new HashSet <string>();
            List <string>    failed      = new List <string>();
            List <string>    completed   = new List <string>();
            List <string>    disappeared = new List <string>();

            foreach (var mi in m.ActiveMissions)
            {
                string kn = MissionList.Key(mi.MissionID, mi.Name);
                active.Add(kn);
                //System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Mission " + kn + " is active");

                if (missionlist.Missions.ContainsKey(kn))
                {
                    MissionState ms = missionlist.Missions[kn];

                    if (ms.State == MissionState.StateTypes.Died)   // if marked died...
                    {
                        System.Diagnostics.Debug.WriteLine("Missions in active list but marked died" + kn);
                        toresurrect.Add(kn);
                    }
                }
            }

            foreach (var mi in m.FailedMissions)
            {
                string kn = MissionList.Key(mi.MissionID, mi.Name);
                failed.Add(kn);
            }

            foreach (var mi in m.CompletedMissions)
            {
                string kn = MissionList.Key(mi.MissionID, mi.Name);
                completed.Add(kn);
            }

            foreach (var kvp in missionlist.Missions)
            {
                if (!active.Contains(kvp.Key) && !failed.Contains(kvp.Key) && !completed.Contains(kvp.Key) && kvp.Value.State == MissionState.StateTypes.InProgress)
                {
                    System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Mission " + kvp.Value.Mission.EventTimeUTC.ToStringZulu() + " " + kvp.Key + " disappeared ****");
                    disappeared.Add(kvp.Key);
                }
            }

            if (toresurrect.Count > 0)                      // if any..
            {
                missionlist = new MissionList(missionlist); // shallow copy
                missionlist.Resurrect(toresurrect);
            }

            if (disappeared.Count > 0)
            {
                missionlist = new MissionList(missionlist);
                missionlist.Disappeared(disappeared, m.EventTimeUTC);
            }

            if (failed.Count > 0)
            {
                missionlist = new MissionList(missionlist);
                missionlist.ChangeStateIfInProgress(failed, MissionState.StateTypes.Failed, m.EventTimeUTC);
            }

            if (completed.Count > 0)
            {
                missionlist = new MissionList(missionlist);
                missionlist.ChangeStateIfInProgress(failed, MissionState.StateTypes.Completed, m.EventTimeUTC);
            }
        }