]> git.mxchange.org Git - flightgear.git/commitdiff
#656: COM1 frequency set to 0 at startup
authorThorstenB <brehmt@gmail.com>
Fri, 10 Feb 2012 22:41:33 +0000 (23:41 +0100)
committerThorstenB <brehmt@gmail.com>
Fri, 10 Feb 2012 22:43:03 +0000 (23:43 +0100)
Also, don't flood the screen with AI ATC messages when COM1/2 is set to 0
(ignore aircraft "transmissions" on frequency "0 MHz").

src/ATC/atc_mgr.cxx
src/ATC/trafficcontrol.cxx

index dc5005e70b0d0826c661597bc88c73150d39ef31..d6cb17ff9ea0d8f0cd344721a7d5e36d72789490 100644 (file)
@@ -111,8 +111,11 @@ void FGATCManager::init() {
             if (!runway.empty()) {
                 controller = apt->getDynamics()->getTowerController();
                 int stationFreq = apt->getDynamics()->getTowerFrequency(2);
-                //cerr << "Setting radio frequency to in airfrequency: " << stationFreq << endl;
-                fgSetDouble("/instrumentation/comm[0]/frequencies/selected-mhz", ((double) stationFreq / 100.0));
+                if (stationFreq > 0)
+                {
+                    //cerr << "Setting radio frequency to in airfrequency: " << stationFreq << endl;
+                    fgSetDouble("/instrumentation/comm[0]/frequencies/selected-mhz", ((double) stationFreq / 100.0));
+                }
                 leg = 3;
                 string fltType = "ga";
                 fp->setRunway(runway);
@@ -124,8 +127,11 @@ void FGATCManager::init() {
         } else {
             controller = apt->getDynamics()->getStartupController();
             int stationFreq = apt->getDynamics()->getGroundFrequency(1);
-            //cerr << "Setting radio frequency to : " << stationFreq << endl;
-            fgSetDouble("/instrumentation/comm[0]/frequencies/selected-mhz", ((double) stationFreq / 100.0));
+            if (stationFreq > 0)
+            {
+                //cerr << "Setting radio frequency to : " << stationFreq << endl;
+                fgSetDouble("/instrumentation/comm[0]/frequencies/selected-mhz", ((double) stationFreq / 100.0));
+            }
             leg = 1;
             //double, lat, lon, head; // Unused variables;
             //int getId = apt->getDynamics()->getParking(gateId, &lat, &lon, &head);
index a0a4d98d802816c610d16569d6923c213a2ddedf..8e29f04d05af3b889a5ae9cf5909c24347bc31bd 100644 (file)
@@ -725,8 +725,9 @@ void FGATCController::transmit(FGTrafficRecord * rec, FGAirportDynamics *parent,
         // the relevant frequency.
         // Note that distance attenuation is currently not yet implemented
                 
-        if ((onBoardRadioFreqI0 == stationFreq)
-                || (onBoardRadioFreqI1 == stationFreq)) {
+        if ((stationFreq > 0)&&
+            ((onBoardRadioFreqI0 == stationFreq)||
+             (onBoardRadioFreqI1 == stationFreq))) {
             if (rec->allowTransmissions()) {
                
                if( fgGetBool( "/sim/radio/use-itm-attenuation", false ) ) {