]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/approach.hxx
fix another crash on exit by finally converting the rest of unguarded
[flightgear.git] / src / ATC / approach.hxx
index debcd77d33eca318064f9e80f897edbb545c780d..9aec71d0174e96bc9535d99387d31ffe8ca27609 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 
 #ifndef _FG_APPROACH_HXX
@@ -61,7 +61,7 @@ SG_USING_STD(string);
 const int    max_planes = 20;  // max number of planes on the stack
 const int    max_wp = 10;      // max number of waypoints for approach phase
 const double max_ta = 130;     // max turning angle for plane during approach
-const double tbm    = 20000.0; // min time (in ms) between two messages
+const double tbm    = 2.0;     // min time (in sec) between two messages
 const double lfl    = 10.0;    // length of final leg
 
 struct PlaneApp {
@@ -117,27 +117,25 @@ class FGApproach : public FGATC {
   double active_rw_lat;
   double active_rw_len;
 
-  bool     display;            // Flag to indicate whether we should be outputting to the display.
-  bool     displaying;         // Flag to indicate whether we are outputting to the display.
   int      num_planes;          // number of planes on the stack
   PlaneApp planes[max_planes];  // Array of planes
   string   transmission;
   bool     first;
 
-  SGPropertyNode *comm1_node;
-  SGPropertyNode *comm2_node;
-
-  SGPropertyNode *atcmenu_node;
-  SGPropertyNode *atcopt0_node;
-  SGPropertyNode *atcopt1_node;
-  SGPropertyNode *atcopt2_node;
-  SGPropertyNode *atcopt3_node;
-  SGPropertyNode *atcopt4_node;
-  SGPropertyNode *atcopt5_node;
-  SGPropertyNode *atcopt6_node;
-  SGPropertyNode *atcopt7_node;
-  SGPropertyNode *atcopt8_node;
-  SGPropertyNode *atcopt9_node;
+  SGPropertyNode_ptr comm1_node;
+  SGPropertyNode_ptr comm2_node;
+
+  SGPropertyNode_ptr atcmenu_node;
+  SGPropertyNode_ptr atcopt0_node;
+  SGPropertyNode_ptr atcopt1_node;
+  SGPropertyNode_ptr atcopt2_node;
+  SGPropertyNode_ptr atcopt3_node;
+  SGPropertyNode_ptr atcopt4_node;
+  SGPropertyNode_ptr atcopt5_node;
+  SGPropertyNode_ptr atcopt6_node;
+  SGPropertyNode_ptr atcopt7_node;
+  SGPropertyNode_ptr atcopt8_node;
+  SGPropertyNode_ptr atcopt9_node;
 
   // for failure modeling
   string trans_ident;  // transmitted ident
@@ -150,26 +148,19 @@ public:
 
   void Init();
 
-  void Update();
+  void Update(double dt);
 
   // Add new plane to stack if not already registered 
   // Input:  pid - id of plane (name) 
   // Output: "true" if added; "false" if already existend
-  void AddPlane(string pid);
+  void AddPlane(const string& pid);
 
   // Remove plane from stack if out of range
   int RemovePlane();
   
-  //Indicate that this instance should be outputting to the ATC display
-  inline void SetDisplay(void) {display = true;}
-  
-  //Indicate that this instance should not be outputting to the ATC display
-  inline void SetNoDisplay(void) {display = false;}
-  
   inline double get_bucket() const { return bucket; }
   inline int get_pnum() const { return num_planes; }
-  inline string get_trans_ident() { return trans_ident; }
-  inline atc_type GetType() { return APPROACH; }
+  inline const string& get_trans_ident() { return trans_ident; }
   
 private:
 
@@ -185,6 +176,8 @@ private:
 
   double angle_diff_deg( const double &a1, const double &a2);
 
+  void set_message(const string &s);
+
 // ========================================================================
 // get point2 given starting point1 and course and distance
 // input:  point1 = heading in degrees, distance
@@ -222,12 +215,12 @@ private:
                       const double &h3);
 
   // Pointers to current users position
-  SGPropertyNode *lon_node;
-  SGPropertyNode *lat_node;
-  SGPropertyNode *elev_node;
-  SGPropertyNode *hdg_node;
-  SGPropertyNode *speed_node;
-  SGPropertyNode *etime_node;
+  SGPropertyNode_ptr lon_node;
+  SGPropertyNode_ptr lat_node;
+  SGPropertyNode_ptr elev_node;
+  SGPropertyNode_ptr hdg_node;
+  SGPropertyNode_ptr speed_node;
+  SGPropertyNode_ptr etime_node;
   
   //Update the transmission string
   void UpdateTransmission(void);