X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAIAircraft.hxx;h=8d16f381e57136aa1134af72c1dad05750d40c30;hb=863b0c943251fae620406ec8983e5f69e1424731;hp=759cca93c36e780357229b0ebd86c996493c190e;hpb=cd0c447b43bf9f7ea2e11a1e8914efc3b0516158;p=flightgear.git diff --git a/src/AIModel/AIAircraft.hxx b/src/AIModel/AIAircraft.hxx index 759cca93c..8d16f381e 100644 --- a/src/AIModel/AIAircraft.hxx +++ b/src/AIModel/AIAircraft.hxx @@ -29,22 +29,44 @@ SG_USING_STD(string); class FGAIAircraft : public FGAIBase { + +private: + + typedef struct { + double accel; + double decel; + double climb_rate; + double descent_rate; + double takeoff_speed; + double climb_speed; + double cruise_speed; + double descent_speed; + double land_speed; + } PERF_STRUCT; public: + + enum aircraft_e {LIGHT=0, WW2_FIGHTER, JET_TRANSPORT, JET_FIGHTER}; + static const PERF_STRUCT settings[]; FGAIAircraft(); ~FGAIAircraft(); bool init(); + virtual void bind(); + virtual void unbind(); void update(double dt); - void SetPerformance(PERF_STRUCT ps); + void SetPerformance(const PERF_STRUCT *ps); void AccelTo(double speed); void PitchTo(double angle); void RollTo(double angle); void YawTo(double angle); void ClimbTo(double altitude); void TurnTo(double heading); + +protected: + static FGAIAircraft *_self; private: @@ -53,10 +75,20 @@ private: double dt; - PERF_STRUCT performance; + const PERF_STRUCT *performance; 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