Пример #1
0
        /// <summary>Deletes a Flight Group, performing all necessary cleanup to avoid broken indexes.</summary>
        /// <param name="fgIndex">The FG index to delete</param>
        /// <returns>The index of the next available FlightGroup if successfull, otherwise <b>-1</b></returns>
        /// <remarks>Propagates throughout all members which may reference Flight Group indexes.</remarks>
        public int DeleteFG(int fgIndex)
        {
            if (fgIndex < 0 || fgIndex >= FlightGroups.Count)
            {
                return(0);                 //If for some reason this is out of range, don't do anything and return selection to first item.
            }
            foreach (Globals.Goal goal in GlobalGoals.Goals)
            {
                foreach (Mission.Trigger trig in goal.Triggers)
                {
                    trig.TransformFGReferences(fgIndex, -1, false);
                }
            }

            foreach (Message msg in Messages)
            {
                foreach (Mission.Trigger trig in msg.Triggers)
                {
                    trig.TransformFGReferences(fgIndex, -1, true);
                }
            }

            Briefing.TransformFGReferences(fgIndex, -1);

            foreach (FlightGroup fg in FlightGroups)
            {
                fg.TransformFGReferences(fgIndex, -1);
            }

            return(FlightGroups.RemoveAt(fgIndex));             //This handles all the cleanup within the FlightGroupCollection itself.
        }
Пример #2
0
 void _initialize()
 {
     OfficersPresent      = BriefingOfficers.FlightOfficer;
     _invalidError        = _invalidError.Replace("{0}", "TIE");
     _iffHostile[0]       = true;
     _iffNameIndexer      = new IffNameIndexer(this);
     _iffHostileIndexer   = new Indexer <bool>(_iffHostile, new bool[] { true, true, false, false, false, false });
     _endOfMissionIndexer = new Indexer <string>(_endOfMissionMessages, 63);
     FlightGroups         = new FlightGroupCollection();
     Messages             = new MessageCollection();
     GlobalGoals          = new Globals();
     Briefing             = new Briefing();
     BriefingQuestions    = new Questions();
 }
Пример #3
0
        /// <summary>Swaps two FlightGroups.</summary>
        /// <param name="srcIndex">The original index</param>
        /// <param name="dstIndex">The new index</param>
        /// <remarks>Automatically performs bounds checking and adjusts all references in the mission to prevent breaking any indexes for triggers, orders, etc.</remarks>
        /// <returns>Returns <b>true</b> if an adjustment was performed, <b>false</b> if index validation failed.</returns>
        public bool SwapFG(int srcIndex, int dstIndex)
        {
            if ((srcIndex < 0 || srcIndex >= FlightGroups.Count) || (dstIndex < 0 || dstIndex >= FlightGroups.Count) || (srcIndex == dstIndex))
            {
                return(false);
            }

            foreach (Globals.Goal goal in GlobalGoals.Goals)
            {
                foreach (Mission.Trigger trig in goal.Triggers)
                {
                    trig.SwapFGReferences(srcIndex, dstIndex);
                }
            }

            foreach (Message msg in Messages)
            {
                foreach (Mission.Trigger trig in msg.Triggers)
                {
                    trig.SwapFGReferences(srcIndex, dstIndex);
                }
            }

            Briefing.SwapFGReferences(srcIndex, dstIndex);

            foreach (FlightGroup fg in FlightGroups)
            {
                fg.TransformFGReferences(dstIndex, 255);
                fg.TransformFGReferences(srcIndex, dstIndex);
                fg.TransformFGReferences(255, srcIndex);
            }
            FlightGroup temp = FlightGroups[srcIndex];

            FlightGroups[srcIndex] = FlightGroups[dstIndex];
            FlightGroups[dstIndex] = temp;

            return(true);
        }
Пример #4
0
 void _initialize()
 {
     OfficersPresent = BriefingOfficers.FlightOfficer;
     _invalidError = _invalidError.Replace("{0}", "TIE");
     _iffHostile[0] = true;
     _iffNameIndexer = new IffNameIndexer(this);
     _iffHostileIndexer = new Indexer<bool>(_iffHostile, new bool[]{true, true, false, false, false, false});
     _endOfMissionIndexer = new Indexer<string>(_endOfMissionMessages, 63);
     FlightGroups = new FlightGroupCollection();
     Messages = new MessageCollection();
     GlobalGoals = new Globals();
     Briefing = new Briefing();
     BriefingQuestions = new Questions();
 }