]> git.mxchange.org Git - flightgear.git/commitdiff
Take the static temperature, static pressure, and density values from
authordavid <david>
Wed, 15 May 2002 12:10:48 +0000 (12:10 +0000)
committerdavid <david>
Wed, 15 May 2002 12:10:48 +0000 (12:10 +0000)
an external source if requested by the
/environment/params/control-fdm-atmosphere property.

src/FDM/YASim/Atmosphere.cpp

index 18b54dd2431a0df84398175ffea428e29fcbc453..bc8a754dd780e74f41d303cecb0a08284bd0851c 100644 (file)
@@ -1,3 +1,5 @@
+#include <Main/fg_props.hxx>
+
 #include "Math.hpp"
 #include "Atmosphere.hpp"
 namespace yasim {
@@ -40,17 +42,26 @@ const float GAMMA = 1.4f;
 
 float Atmosphere::getStdTemperature(float alt)
 {
-    return getRecord(alt, 1);
+    if (fgGetBool("/environment/params/control-fdm-atmosphere"))
+        return fgGetDouble("/environment/temperature-degC") + 273.15;
+    else
+        return getRecord(alt, 1);
 }
 
 float Atmosphere::getStdPressure(float alt)
 {
-    return getRecord(alt, 2);
+    if (fgGetBool("/environment/params/control-fdm-atmosphere"))
+        return fgGetDouble("/environment/pressure-inhg") * 3386.39;
+    else
+        return getRecord(alt, 2);
 }
 
 float Atmosphere::getStdDensity(float alt)
 {
-    return getRecord(alt, 3);
+    if (fgGetBool("/environment/params/control-fdm-atmosphere"))
+        return fgGetDouble("/environment/density-slugft3") * 515.378;
+    else
+        return getRecord(alt, 3);
 }
 
 float Atmosphere::calcVEAS(float spd, float pressure, float temp)