]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/AIPlane.hxx
I had hoped that gmtime's lack of thread-safety wouldn't bite us. It does.
[flightgear.git] / src / ATC / AIPlane.hxx
index 544212ee08f1be0f3ae7ad041b7034c60fc1d9b4..630767207c7ca8e93347e3e627ad9db99db769c5 100644 (file)
@@ -21,8 +21,6 @@
 #ifndef _FG_AI_PLANE_HXX
 #define _FG_AI_PLANE_HXX
 
-#include <plib/sg.h>
-#include <plib/ssg.h>
 #include <simgear/math/point3d.hxx>
 #include <simgear/scene/model/model.hxx>
 
@@ -82,12 +80,12 @@ public:
        inline PatternLeg GetLeg() {return leg;}
        
        // Return what type of landing we're doing on this circuit
-       LandingType GetLandingOption();
+       virtual LandingType GetLandingOption();
+       
+       // Return the callsign
+       inline string GetCallsign() {return plane.callsign;}
 
 protected:
-       // callback type for derived classes to use
-       typedef void (*ai_plane_callback_t) (void);
-
        PlaneRec plane;
 
     double mag_hdg;    // degrees - the heading that the physical aircraft is *pointing*
@@ -113,23 +111,29 @@ protected:
        FGATC* tuned_station;                   // and this if they are tuned to ATC
        
        // Transmit a message when channel becomes free of other dialog
-    void Transmit(ai_plane_callback_t callback = NULL);
+    void Transmit(int callback_code = 0);
        
        // Transmit a message if channel becomes free within timeout (seconds). timeout of zero implies no limit
-       void Transmit(double timeout, ai_plane_callback_t callback = NULL);
+       void ConditionalTransmit(double timeout, int callback_code = 0);
        
        // Transmit regardless of other dialog on the channel eg emergency
-       void ImmediateTransmit(ai_plane_callback_t callback = NULL);
+       void ImmediateTransmit(int callback_code = 0);
+       
+       inline void SetTrack(double t) { _tgtTrack = t; _trackSet = true; }
+       inline void ClearTrack() { _trackSet = false; }
 
-    void Bank(double angle);
-    void LevelWings(void);
+    inline void Bank(double r) { _tgtRoll = r; }
+    inline void LevelWings(void) { _tgtRoll = 0.0; }
+       
+       virtual void ProcessCallback(int code);
        
        PatternLeg leg;
        
 private:
        bool _pending;
        double _timeout;
-       ai_plane_callback_t _callback;
+       int _callback_code;     // A callback code to be notified and processed by the derived classes
+                                               // A value of zero indicates no callback required
        bool _transmit;         // we are to transmit
        bool _transmitting;     // we are transmitting
        double _counter;
@@ -150,6 +154,12 @@ private:
        bool playing;           // Indicates a message in progress      
        bool voiceOK;           // Flag - true if at least one voice has loaded OK
        FGATCVoice* vPtr;
+       
+       // Navigation
+       double _tgtTrack;       // Track to be following if _trackSet is true
+       bool _trackSet;         // Set true if tgtTrack is to be followed
+       double _tgtRoll;
+       bool _rollSuspended;    // Set true when a derived class has suspended AIPlane's roll control
 };
 
 #endif  // _FG_AI_PLANE_HXX