Added check to make sure that ApA is outside of the atmosphere -- was causing "dT is NaN!" spam while s/c orbit still in the atmosphere, see http://bugs.kerbalspaceprogram.com/issues/5334 for more details.
[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
@@ -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();