/// <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); }
void craftStart(FlightGroup fg, bool bAdd) { if (fg.Difficulty == 1 || fg.Difficulty == 3 || !fg.ArrivesIn30Seconds) return; if (bAdd) _startingShips += fg.NumberOfCraft; else _startingShips -= fg.NumberOfCraft; lblStarting.Text = _startingShips.ToString() + " Craft at 30 seconds"; if (_startingShips > Mission.CraftLimit) lblStarting.ForeColor = Color.Red; else lblStarting.ForeColor = SystemColors.ControlText; }