From: ThorstenB Date: Fri, 10 Feb 2012 22:41:33 +0000 (+0100) Subject: #656: COM1 frequency set to 0 at startup X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a8d5ac90c6c3ea87d11ca4bdee25e38714add13f;p=flightgear.git #656: COM1 frequency set to 0 at startup Also, don't flood the screen with AI ATC messages when COM1/2 is set to 0 (ignore aircraft "transmissions" on frequency "0 MHz"). --- diff --git a/src/ATC/atc_mgr.cxx b/src/ATC/atc_mgr.cxx index dc5005e70..d6cb17ff9 100644 --- a/src/ATC/atc_mgr.cxx +++ b/src/ATC/atc_mgr.cxx @@ -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); diff --git a/src/ATC/trafficcontrol.cxx b/src/ATC/trafficcontrol.cxx index a0a4d98d8..8e29f04d0 100644 --- a/src/ATC/trafficcontrol.cxx +++ b/src/ATC/trafficcontrol.cxx @@ -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 ) ) {