Privatized public resources.
Privatized public resources.

--- a/ARFlightController.cs
+++ b/ARFlightController.cs
@@ -165,7 +165,7 @@
 			if (this.appLauncherButton == null && !ToolbarManager.ToolbarAvailable && ApplicationLauncher.Ready)
 			{
 				this.appLauncherButton = ApplicationLauncher.Instance.AddModApplication(
-					ApplicationLauncher.AppScenes.FLIGHT,
+					ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW,
 					this.appLauncherTextures[ConnectionStatus.None]
 				);
 			}
@@ -235,11 +235,7 @@
 
 			this.log.Clear();
 
-			if (
-				(this.toolbarButton != null || this.appLauncherButton != null) &&
-				HighLogic.LoadedSceneIsFlight &&
-				FlightGlobals.ActiveVessel != null
-			)
+			if (HighLogic.LoadedSceneIsFlight && FlightGlobals.ActiveVessel != null)
 			{
 				Vessel vessel;
 				IAntennaRelay relay;
@@ -270,29 +266,32 @@
 					relay.FindNearestRelay();
 				}
 
-				log.Append("Checking vessel relay status.\n");
-
-				this.currentConnectionStatus = FlightGlobals.ActiveVessel.GetConnectionStatus();
-
-				log.AppendFormat("currentConnectionStatus: {0}, setting texture to {1}",
-					this.currentConnectionStatus, this.currentConnectionTexture);
-
-				if (this.toolbarButton != null)
-				{
-					this.toolbarButton.TexturePath = this.currentConnectionTexture;
-
-					if (this.currentConnectionStatus == ConnectionStatus.None)
+				if (this.toolbarButton != null || this.appLauncherButton != null)
+				{
+					log.Append("Checking vessel relay status.\n");
+
+					this.currentConnectionStatus = FlightGlobals.ActiveVessel.GetConnectionStatus();
+
+					log.AppendFormat("currentConnectionStatus: {0}, setting texture to {1}",
+						this.currentConnectionStatus, this.currentConnectionTexture);
+
+					if (this.toolbarButton != null)
 					{
-						this.toolbarButton.Important = true;
+						this.toolbarButton.TexturePath = this.currentConnectionTexture;
+
+						if (this.currentConnectionStatus == ConnectionStatus.None)
+						{
+							if (!this.toolbarButton.Important) this.toolbarButton.Important = true;
+						}
+						else
+						{
+							if (this.toolbarButton.Important) this.toolbarButton.Important = false;
+						}
 					}
-					else
+					if (this.appLauncherButton != null)
 					{
-						this.toolbarButton.Important = false;
+						this.appLauncherButton.SetTexture(this.currentAppLauncherTexture);
 					}
-				}
-				if (this.appLauncherButton != null)
-				{
-					this.appLauncherButton.SetTexture(this.currentAppLauncherTexture);
 				}
 			}
 

--- a/ARMapRenderer.cs
+++ b/ARMapRenderer.cs
@@ -159,7 +159,9 @@
 
 						log.AppendFormat("\n\tChecking vessel {0}.", vessel.vesselName);
 
+						#if DEBUG
 						start = timer.ElapsedMilliseconds;
+						#endif
 
 						IAntennaRelay vesselRelay = vessel.GetBestRelay();
 
@@ -173,7 +175,9 @@
 
 						if (vesselRelay != null)
 						{
+							#if DEBUG
 							start = timer.ElapsedMilliseconds;
+							#endif
 
 							this.SetRelayVertices(vesselRelay);
 
@@ -242,7 +246,9 @@
 
 			int idx = 0;
 
+			#if DEBUG
 			relayStart = timer.ElapsedMilliseconds;
+			#endif
 
 			Vector3d nextPoint;
 

--- a/AntennaRange.csproj
+++ b/AntennaRange.csproj
@@ -80,7 +80,6 @@
     <Compile Include="ARConfiguration.cs" />
     <Compile Include="ARFlightController.cs" />
     <Compile Include="ARMapRenderer.cs" />
-    <Compile Include="VesselCache.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>

--- a/AntennaRelay.cs
+++ b/AntennaRelay.cs
@@ -37,8 +37,8 @@
 	/// </summary>
 	public class AntennaRelay
 	{
-		public static readonly System.Diagnostics.Stopwatch searchTimer = new System.Diagnostics.Stopwatch();
-		public const long millisecondsBetweenSearches = 125L;
+		private static readonly System.Diagnostics.Stopwatch searchTimer = new System.Diagnostics.Stopwatch();
+		private const long millisecondsBetweenSearches = 125L;
 
 		// We don't have a Bard, so we'll hide Kerbin here.
 		private static CelestialBody _Kerbin;
@@ -629,7 +629,9 @@
 			#if DEBUG
 			} catch (Exception ex) {
 				log.AppendFormat("\nCaught {0}: {1}\n{2}", ex.GetType().FullName, ex.ToString(), ex.StackTrace);
+			#if QUIT_ON_EXCEPTION
 				UnityEngine.Application.Quit();
+			#endif
 			} finally {
 			#endif
 			log.Print(false);