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:
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