]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATCDCL/ATC.hxx
CMake update for new KLN89 file.
[flightgear.git] / src / ATCDCL / ATC.hxx
index adb62264ec896dad68dad2932a3633e504af758b..e5ddcd0a9a97cd4502a6bb00f8859552052e4271 100644 (file)
 
 #include <simgear/constants.h>
 #include <simgear/compiler.h>
+#include <simgear/props/props.hxx>
 #include <simgear/misc/sgstream.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/debug/logstream.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
 
 #include <iosfwd>
 #include <string>
 
 #include "ATCVoice.hxx"
 
+class SGSampleGroup;
+
 // Convert a frequency in MHz to tens of kHz
 // so we can use it e.g. as an index into commlist_freq
 //
@@ -61,6 +65,8 @@ enum plane_type {
 // PlaneRec - a structure holding ATC-centric details of planes under control
 // This might move or change eventually
 struct PlaneRec {
+        PlaneRec() : type(UNKNOWN), squawkcode(0) {}
+        PlaneRec(const std::string& s) : type(UNKNOWN), callsign(s), squawkcode(0) {}
        plane_type type;
        std::string callsign;
        int squawkcode;
@@ -76,16 +82,17 @@ enum atc_type {
        APPROACH,
        DEPARTURE,
        ENROUTE,
-  INVALID     /* must be last element;  see ATC_NUM_TYPES */
+  INVALID       /* must be last element;  see ATC_NUM_TYPES */
 };
 
 const int ATC_NUM_TYPES = 1 + INVALID;
 
 // DCL - new experimental ATC data store
 struct ATCData {
+        ATCData() : type(INVALID), cart(0, 0, 0), freq(0), range(0) {}
        atc_type type;
-  SGGeod geod;
-  SGVec3d cart;
+       SGGeod geod;
+       SGVec3d cart;
        unsigned short int freq;
        unsigned short int range;
        std::string ident;
@@ -95,6 +102,7 @@ struct ATCData {
 // perhaps we could use an FGRunway instead of this.
 // That wouldn't cache the orthopos though.
 struct RunwayDetails {
+        RunwayDetails() : end1ortho(0, 0, 0), end2ortho(0, 0, 0), hdg(0), length(-1), width(-1) {}
        SGGeod threshold_pos;
        SGVec3d end1ortho;      // ortho projection end1 (the threshold ATM)
        SGVec3d end2ortho;      // ortho projection end2 (the take off end in the current hardwired scheme)
@@ -114,7 +122,7 @@ public:
        FGATC();
        virtual ~FGATC();
        
-  virtual void Init()=0;
+       virtual void Init()=0;
   
        // Run the internal calculations
        // Derived classes should call this method from their own Update methods if they 
@@ -176,15 +184,15 @@ protected:
        // Outputs the transmission either on screen or as audio depending on user preference
        // The refname is a string to identify this sample to the sound manager
        // The repeating flag indicates whether the message should be repeated continuously or played once.
-       void Render(std::string& msg, const double volume = 1.0, 
-    const std::string& refname = "", bool repeating = false);
+       void Render(std::string& msg, const float volume = 1.0, 
+       const std::string& refname = "", bool repeating = false);
        
        // Cease rendering all transmission from this station.
        // Requires the sound manager refname if audio, else "".
        void NoRender(const std::string& refname);
        
        // Transmit a message when channel becomes free of other dialog
-    void Transmit(int callback_code = 0);
+       void Transmit(int callback_code = 0);
        
        // Transmit a message if channel becomes free within timeout (seconds). timeout of zero implies no limit
        void ConditionalTransmit(double timeout, int callback_code = 0);
@@ -197,44 +205,46 @@ protected:
        SGGeod _geod;
        SGVec3d _cart;
        int freq;
-  std::map<std::string,int> active_on;
+       std::map<std::string,int> active_on;
   
        int range;
-       std::string ident;              // Code of the airport its at.
-       std::string name;               // Name transmitted in the broadcast.
+       std::string ident;      // Code of the airport its at.
+       std::string name;       // Name transmitted in the broadcast.
 
        
        // Rendering related stuff
-       bool _voice;                    // Flag - true if we are using voice
-       bool _playing;          // Indicates a message in progress      
-       bool _voiceOK;          // Flag - true if at least one voice has loaded OK
+       bool _voice;    // Flag - true if we are using voice
+       bool _playing;  // Indicates a message in progress      
+       bool _voiceOK;  // Flag - true if at least one voice has loaded OK
        FGATCVoice* _vPtr;
 
+       SGSharedPtr<SGSampleGroup> _sgr; // default sample group;
+
        
-       bool freqClear;         // Flag to indicate if the frequency is clear of ongoing dialog
-       bool receiving;         // Flag to indicate we are receiving a transmission
+       bool freqClear; // Flag to indicate if the frequency is clear of ongoing dialog
+       bool receiving; // Flag to indicate we are receiving a transmission
        
        
-       double responseTime;    // Time to take from end of request transmission to beginning of response
-                                                       // The idea is that this will be slightly random.
+       double responseTime; // Time to take from end of request transmission to beginning of response
+                                                // The idea is that this will be slightly random.
        
-  bool respond;        // Flag to indicate now is the time to respond - ie set following the count down of the response timer.
+       bool respond;   // Flag to indicate now is the time to respond - ie set following the count down of the response timer.
        std::string responseID; // ID of the plane to respond to
-  bool runResponseCounter;     // Flag to indicate the response counter should be run
-  double responseCounter;              // counter to implement the above
+       bool runResponseCounter;        // Flag to indicate the response counter should be run
+       double responseCounter; // counter to implement the above
        // Derived classes only need monitor this flag, and use the response ID, as long as they call FGATC::Update(...)
        bool _runReleaseCounter;        // A timer for releasing the frequency after giving the message enough time to display
-  bool responseReqd;   // Flag to indicate we should be responding to a request/report 
+       bool responseReqd;      // Flag to indicate we should be responding to a request/report 
        double _releaseTime;
        double _releaseCounter;
   atc_type _type;
-       bool _display;          // Flag to indicate whether we should be outputting to the ATC display.
-  std::string pending_transmission;    // derived classes set this string before calling Transmit(...) 
+       bool _display;  // Flag to indicate whether we should be outputting to the ATC display.
+       std::string pending_transmission; // derived classes set this string before calling Transmit(...)       
        
 private:
        // Transmission timing stuff.
        double _timeout;
-  bool _pending;
+       bool _pending;
        
        int _callback_code;     // A callback code to be notified and processed by the derived classes
                                                // A value of zero indicates no callback required
@@ -242,6 +252,11 @@ private:
        bool _transmitting;     // we are transmitting
        double _counter;
        double _max_count;
+
+       SGPropertyNode_ptr _volume;
+       SGPropertyNode_ptr _enabled;
+       SGPropertyNode_ptr _atc_external;
+       SGPropertyNode_ptr _internal;
 };
 
 std::istream& operator>> ( std::istream& fin, ATCData& a );