Added readout of time to next atmosphere boundary encounter
[VesselSimulator.git] / KerbalEngineer / Flight / Readouts / Orbital / TimeToAtmosphere.cs
blob:a/KerbalEngineer/Flight/Readouts/Orbital/TimeToAtmosphere.cs -> blob:b/KerbalEngineer/Flight/Readouts/Orbital/TimeToAtmosphere.cs
--- a/KerbalEngineer/Flight/Readouts/Orbital/TimeToAtmosphere.cs
+++ b/KerbalEngineer/Flight/Readouts/Orbital/TimeToAtmosphere.cs
@@ -37,7 +37,7 @@
         {
             this.Name = "Time to Atmosphere";
             this.Category = ReadoutCategory.GetCategory("Orbital");
-            this.HelpString = "Shows the time until the vessel enters or leaves atmosphere.";
+            this.HelpString = "Shows the time until the vessel enters or leaves the atmosphere.";
             this.IsDefault = false;
         }
 
@@ -50,7 +50,7 @@
             String str;
             Orbit orbit = FlightGlobals.ship_orbit;
 
-            if (orbit.referenceBody.atmosphere && orbit.PeA < orbit.referenceBody.atmosphereDepth)
+			if (orbit.referenceBody.atmosphere && orbit.PeA < orbit.referenceBody.atmosphereDepth && orbit.ApA > orbit.referenceBody.atmosphereDepth)
             {
                 double tA = orbit.TrueAnomalyAtRadius(orbit.referenceBody.atmosphereDepth + orbit.referenceBody.Radius);
                 //log.buf.AppendFormat("tA = {0}\n", tA);
@@ -87,7 +87,7 @@
             else
             {
                 str = "---s";
-                //log.buf.AppendLine("no atmosphere or pe > atmosphere");
+                //log.buf.AppendLine("no atmosphere, pe > atmosphere, or ap < atmosphere");
             }
 
             //log.Flush();