]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/approach.cxx
Roy Vegard Ovesen:
[flightgear.git] / src / ATC / approach.cxx
index 3e54ef5792dd603fc79ede2ce874c60221f17eda..c036a28274f7d33114860858bb990cfbd5d88f2e 100644 (file)
@@ -25,6 +25,7 @@
 #include "ATCDialog.hxx"
 
 #include <Airports/runways.hxx>
+#include <simgear/math/polar3d.hxx>
 #include <simgear/misc/sg_path.hxx>
 
 #ifdef FG_WEATHERCM
@@ -41,6 +42,8 @@
 FGApproach::FGApproach(){
   comm1_node = fgGetNode("/radios/comm[0]/frequencies/selected-mhz", true);
   comm2_node = fgGetNode("/radios/comm[1]/frequencies/selected-mhz", true);
+  
+  _type = APPROACH;
 
   num_planes = 0;
   lon_node   = fgGetNode("/position/longitude-deg", true);
@@ -74,7 +77,6 @@ FGApproach::~FGApproach(){
 }
 
 void FGApproach::Init() {
-  display = false;
 }
 
 
@@ -87,7 +89,7 @@ void FGApproach::Update(double dt) {
        const int max_trans = 20;
        FGTransmission tmissions[max_trans];
        int    wpn;
-       int    station = 1;
+       atc_type station = APPROACH;
        TransCode code;
        TransPar TPar;
        int    i,j;
@@ -111,7 +113,7 @@ void FGApproach::Update(double dt) {
        
        for (i=0; i<num_planes; i++) {
                if ( planes[i].ident == "Player") { 
-                       station = 1;
+                       station = APPROACH;
                        tpars.station = name;
                        tpars.callsign = "Player";
                        tpars.airport = ident;
@@ -125,15 +127,18 @@ void FGApproach::Update(double dt) {
                                // loop over all transmissions for station
                                for ( j=0; j<=num_trans-1; j++ ) {
                                        code = tmissions[j].get_code();
+                                       //cout << "code is " << code.c1 << "  " << code.c2 << "  " << code.c3 << '\n';
                                        // select proper transmissions
-                                       if ( ( code.c2 == -1 && planes[i].lmc.c3 == 0 ) || 
-                                               ( code.c1 == 0  && code.c2 == planes[i].lmc.c2 ) ) {
-                                               mentry = current_transmissionlist->gen_text(station, code, tpars, false);
-                                               transm = current_transmissionlist->gen_text(station, code, tpars, true);
-                                               // is the transmission already registered?
-                                               if (!current_atcdialog->trans_reg( ident, transm )) {
-                                                       current_atcdialog->add_entry( ident, transm, mentry );
-                                               }
+                                       if(code.c3 != 2) {    // DCL - hack to prevent request crossing airspace being displayed since this isn't implemented yet.
+                                           if ( ( code.c2 == -1 && planes[i].lmc.c3 == 0 ) || 
+                                                   ( code.c1 == 0  && code.c2 == planes[i].lmc.c2 ) ) {
+                                                   mentry = current_transmissionlist->gen_text(station, code, tpars, false);
+                                                   transm = current_transmissionlist->gen_text(station, code, tpars, true);
+                                                   // is the transmission already registered?
+                                                   if (!current_atcdialog->trans_reg( ident, transm, APPROACH )) {
+                                                           current_atcdialog->add_entry( ident, transm, mentry, APPROACH, 0 );
+                                                   }
+                                           }
                                        }
                                }
                        }
@@ -230,7 +235,7 @@ void FGApproach::Update(double dt) {
                                        tpars.alt = planes[i].aalt;
                                        message = current_transmissionlist->gen_text(station, code, tpars, true );
                                        //cout << "Approach transmitting...\n";
-                                       //cout << message << '\n';
+                                       //cout << message << endl;
                                        globals->get_ATC_display()->RegisterSingleMessage( message, 0 );
                                        
                                }
@@ -241,7 +246,7 @@ void FGApproach::Update(double dt) {
                                        tpars.runway = active_runway;
                                        message = current_transmissionlist->gen_text(station, code, tpars, true);
                                        //cout << "Approach transmitting 2 ...\n";
-                                       //cout << message << '\n';
+                                       //cout << message << endl;
                                        globals->get_ATC_display()->RegisterSingleMessage( message, 0 );
                                }
                                planes[i].lmc = code;