]> git.mxchange.org Git - flightgear.git/commitdiff
call from FGATCController::transmit()
authoradrian <adrian@localhost.com>
Thu, 24 Nov 2011 04:20:59 +0000 (06:20 +0200)
committeradrian <adrian@localhost.com>
Thu, 24 Nov 2011 04:20:59 +0000 (06:20 +0200)
src/ATC/trafficcontrol.cxx
src/ATC/trafficcontrol.hxx
src/Radio/radio.cxx

index aefc39b429b2e7927ecb820263dc83eb29886811..3e27f919047cf58d21dcbcb86856c2ec663c2399 100644 (file)
@@ -743,7 +743,27 @@ 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);
+               }
+               else {
+                       fgSetString("/sim/messages/atc", text.c_str());
+               }
             }
         }
     } else {
index 90c83edb49c3312bc9b2dd729c6429ba6e9c4d64..7c17665f9900043a173d1aae930437100dc73306 100644 (file)
@@ -453,7 +453,7 @@ public:
     void   setDt(double dt) {
         dt_count = dt;
     };
-    void transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir msgDir, bool audible);
+    void transmit(FGTrafficRecord *rec, FGAirportDynamics *parent, AtcMsgId msgId, AtcMsgDir msgDir, bool audible);
     string getGateName(FGAIAircraft *aircraft);
     virtual void render(bool) = 0;
     virtual string getName()  = 0;
index fdd8dd41660e0c5d0210b864fe45fa3579cc8c46..5ce656f6ce1abce775afa344ab603ef448f3fc6b 100644 (file)
@@ -54,7 +54,7 @@ FGRadio::~FGRadio()
 }
 
 
-double FGCommRadio::getFrequency(int radio) {
+double FGRadio::getFrequency(int radio) {
        double freq = 118.0;
        switch (radio) {
                case 1: