]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIWingman.hxx
commradio: improvements for atis speech
[flightgear.git] / src / AIModel / AIWingman.hxx
index c61de7f34cfe99843a7488975e70e9913c96f106..0b02b7491226b9de72c627845b3ff48be84de3e6 100644 (file)
 #include "AIManager.hxx"
 #include "AIBase.hxx"
 
+#include <simgear/sg_inlines.h>
+
+
 class FGAIWingman : public FGAIBallistic {
 public:
     FGAIWingman();
     virtual ~FGAIWingman();
 
     virtual void readFromScenario(SGPropertyNode* scFileNode);
-    virtual void bind();
-    virtual void unbind();
-    virtual const char* getTypeString(void) const { return "wingman"; }
 
     bool init(bool search_in_AI_path=false);
+    virtual void bind();
+    virtual void reinit();
+    virtual void update (double dt);
+
+    virtual const char* getTypeString(void) const { return "wingman"; }
 
 private:
+    void formateToAC(double dt);
+    void Break(double dt);
+    void Join(double dt);
+    void Run(double dt);
 
-    virtual void reinit() { init(); }
-    virtual void update (double dt);
+    double getDistanceToOffset() const;
+    double getElevToOffset() const;
+
+    double calcAngle(double rangeM, SGGeod pos1, SGGeod pos2);
+    double calcDistanceM(SGGeod pos1, SGGeod pos2) const;
+
+    bool   _formate_to_ac;
+    bool   _break;
+    bool   _join;
+
+    double _break_angle; //degrees relative
+    double _coeff_hdg; //dimensionless coefficient
+    double _coeff_pch; //dimensionless coefficient
+    double _coeff_bnk; //dimensionless coefficient
+    double _coeff_spd; //dimensionless coefficient
+
+    SGPropertyNode_ptr user_WoW_node;
+
+    inline void setFormate(bool f);
+    inline void setTgtHdg(double hdg);
+    inline void setTgtSpd(double spd);
+    inline void setBrkHdg(double angle);
+    inline void setBrkAng(double angle);
+    inline void setCoeffHdg(double h);
+    inline void setCoeffPch(double p);
+    inline void setCoeffBnk(double r);
+    inline void setCoeffSpd(double s);
+
+    inline bool getFormate() const { return _formate_to_ac;}
+
+    inline double getTgtHdg() const { return tgt_heading;}
+    inline double getTgtSpd() const { return tgt_speed;}
+    inline double getBrkAng() const { return _break_angle;}
+
+    inline SGVec3d getCartInPos(SGGeod in_pos) const;
 
 };
 
+void FGAIWingman::setFormate(bool f) {
+    _formate_to_ac = f;
+}
+
+void FGAIWingman::setTgtHdg(double h) {
+    tgt_heading = h;
+}
+
+void FGAIWingman::setTgtSpd(double s) {
+    tgt_speed = s;
+}
+
+void FGAIWingman::setBrkHdg(double a){
+    tgt_heading = hdg + a ;
+    SG_NORMALIZE_RANGE(tgt_heading, 0.0, 360.0);
+}
+
+void FGAIWingman::setBrkAng(double a){
+    _break_angle = a ;
+    SG_NORMALIZE_RANGE(_break_angle, -180.0, 180.0);
+}
+
+void FGAIWingman::setCoeffHdg(double h){
+    _coeff_hdg = h;
+}
+
+void FGAIWingman::setCoeffPch(double p){
+    _coeff_pch = p;
+}
+
+void FGAIWingman::setCoeffBnk(double b){
+    _coeff_bnk = b;
+}
+
+void FGAIWingman::setCoeffSpd(double s){
+    _coeff_spd = s;
+}
+
+//bool FGAIWingman::getFormate() const {
+//    return _formate_to_ac;
+//}
+
+//double FGAIWingman::getTgtHdg() const{
+//    return tgt_heading;
+//}
+
+//double FGAIWingman::getTgtSpd() const{
+//    return tgt_speed;
+//}
+
+//double FGAIWingman::getBrkAng() const{
+//    return _break_angle;
+//}
+
+SGVec3d FGAIWingman::getCartInPos(SGGeod in_pos) const {
+    SGVec3d cartPos = SGVec3d::fromGeod(in_pos);
+    return cartPos;
+}
+
 #endif  // FG_AIWINGMAN_HXX