]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/trafficcontrol.cxx
cleanup
[flightgear.git] / src / ATC / trafficcontrol.cxx
index aefc39b429b2e7927ecb820263dc83eb29886811..507c8f11388d40ae1a07331929eaace06a1745a6 100644 (file)
@@ -47,6 +47,7 @@
 #include <Airports/groundnetwork.hxx>
 #include <Airports/dynamics.hxx>
 #include <Airports/simple.hxx>
+#include <Radio/radio.hxx>
 
 using std::sort;
 
@@ -743,7 +744,28 @@ void FGATCController::transmit(FGTrafficRecord * rec, FGAirportDynamics *parent,
                 || (onBoardRadioFreqI1 == stationFreq)) {
             if (rec->allowTransmissions()) {
                
-                fgSetString("/sim/messages/atc", text.c_str());
+               if( fgGetBool( "/instrumentation/use-itm-attenuation", false ) ) {
+                       FGRadio* radio = new FGRadio();
+                       SGGeod sender_pos;
+                       double sender_alt_ft, sender_alt;
+                       if(ground_to_air) {
+                                     sender_alt_ft = parent->getElevation();
+                                     sender_alt = sender_alt_ft * SG_FEET_TO_METER;
+                                     sender_pos= SGGeod::fromDegM( parent->getLongitude(),
+                                     parent->getLatitude(), sender_alt );
+                               }
+                               else {
+                                     sender_alt_ft = rec->getAltitude();
+                                     sender_alt = sender_alt_ft * SG_FEET_TO_METER;
+                                     sender_pos= SGGeod::fromDegM( rec->getLongitude(),
+                                            rec->getLatitude(), sender_alt );
+                               }
+                       radio->receiveText(sender_pos, stationFreq, text, ground_to_air);
+                       delete radio;
+               }
+               else {
+                       fgSetString("/sim/messages/atc", text.c_str());
+               }
             }
         }
     } else {