VOID_TWR: Moved sortedBodyList and its generation into VOID_Core, and prompted VOID_EditorCore to load it.
[VOID.git] / VOID_Core.cs
blob:a/VOID_Core.cs -> blob:b/VOID_Core.cs
--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -245,6 +245,12 @@
 			}
 		}
 
+		public List<CelestialBody> sortedBodyList
+		{
+			get;
+			private set;
+		}
+
 		public CelestialBody Kerbin
 		{
 			get
@@ -958,6 +964,16 @@
 			{
 				this.LoadVesselTypes();
 			}
+
+			if (this.sortedBodyList == null && FlightGlobals.Bodies != null && FlightGlobals.Bodies.Count > 0)
+			{
+				this.sortedBodyList = new List<CelestialBody>(FlightGlobals.Bodies);
+				this.sortedBodyList.Sort(new CBListComparer());
+				this.sortedBodyList.Reverse();
+
+				Debug.Log(string.Format("sortedBodyList: {0}", string.Join("\n\t", this.sortedBodyList.Select(b => b.bodyName).ToArray())));
+			}
+
 		}
 
 		protected void InitializeToolbarButton()