]> 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 43aab0384390c969dda1899b00d4f1dc2eedaed9..8d16f381e57136aa1134af72c1dad05750d40c30 100644 (file)
@@ -53,6 +53,8 @@ public:
        ~FGAIAircraft();
        
        bool init();
+        virtual void bind();
+        virtual void unbind();
        void update(double dt);
 
         void SetPerformance(const PERF_STRUCT *ps);
@@ -62,6 +64,9 @@ public:
         void YawTo(double angle);
         void ClimbTo(double altitude);
         void TurnTo(double heading);
+
+protected:
+        static FGAIAircraft *_self;
        
 private:
 
@@ -74,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