]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIAircraft.hxx
Make the AI models a bit more intelligent. The Gear should be extended and retracted...
[flightgear.git] / src / AIModel / AIAircraft.hxx
index 8cf2a40364c53be58b0085269e13dd9fb448d8d2..8d16f381e57136aa1134af72c1dad05750d40c30 100644 (file)
@@ -64,6 +64,9 @@ public:
         void YawTo(double angle);
         void ClimbTo(double altitude);
         void TurnTo(double heading);
+
+protected:
+        static FGAIAircraft *_self;
        
 private:
 
@@ -76,6 +79,16 @@ private:
 
        void Run(double dt);
         double sign(double x); 
+
+        static bool _getGearDown();
 };
 
+inline bool FGAIAircraft::_getGearDown() {
+    return ((fgGetFloat("/position/altitude-agl-ft") < 150.0)
+             && (fgGetFloat("/orientation/pitch-deg") < 0.0)
+             && (fgGetFloat("/velocities/airspeed-kt")
+                   < _self->performance->land_speed*1.5));
+}
+
+
 #endif  // _FG_AIAircraft_HXX