private void AddSubGroup(Tracking_MoonGroup subGroup) { Tracking_SubGroup sub = new Tracking_SubGroup(Tracking_Utils.LocalizeBodyName(subGroup.Moon.displayName), Tracking_Persistence.GetBodyPersistence(subGroup.Moon.flightGlobalsIndex), _instant, subGroup.Vessels, subGroup.Moon, _mode); _subGroups.Add(sub); }
private List <Tracking_Group> SortCelestialBodies() { List <Tracking_Group> vesselGroups = new List <Tracking_Group>(); int count = _OrderedBodyList.Count; for (int i = 0; i < count; i++) { Tracking_BodyGroup body = _OrderedBodyList[i]; List <TrackingStationWidget> bodyVessels = new List <TrackingStationWidget>(); int vessels = _TrackedVesselWidgets.Count; for (int j = 0; j < vessels; j++) { if (_TrackedVesselWidgets[j].vessel.mainBody == body.Body) { bodyVessels.Add(_TrackedVesselWidgets[j]); } } List <Tracking_MoonGroup> moonGroups = new List <Tracking_MoonGroup>(); int moons = body.Moons.Count; for (int k = 0; k < moons; k++) { List <TrackingStationWidget> moonVessels = new List <TrackingStationWidget>(); for (int l = 0; l < vessels; l++) { if (_TrackedVesselWidgets[l].vessel.mainBody == body.Moons[k]) { moonVessels.Add(_TrackedVesselWidgets[l]); } } if (moonVessels.Count > 0) { moonGroups.Add(new Tracking_MoonGroup() { Moon = body.Moons[k], Vessels = SortWidgets(moonVessels) }); } } if (bodyVessels.Count > 0 || moonGroups.Count > 0) { vesselGroups.Add(new Tracking_Group(Tracking_Utils.LocalizeBodyName(body.Body.displayName), Tracking_Persistence.GetBodyPersistence(body.Body.flightGlobalsIndex), _instantStart, SortWidgets(bodyVessels), moonGroups, body.Body, VesselType.Unknown, Tracking_Mode.CelestialBody)); } } return(vesselGroups); }