]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATCDCL/ATC.cxx
Fix file access mode for newnavradio.[ch]xx
[flightgear.git] / src / ATCDCL / ATC.cxx
index 30d3d23e8dc3ff82f9b4a0a94cfb5d93379fe8ef..776ec34419e1a433d1aba6fbf8e6def7c0ebec3d 100644 (file)
@@ -31,8 +31,8 @@
 
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
-
-
+#include <ATC/CommStation.hxx>
+#include <Airports/simple.hxx>
 
 FGATC::FGATC() :
        _playing(false),
@@ -181,14 +181,20 @@ void FGATC::NotifyTransmissionFinished(const string& rid) {
        }
 }
 
-void FGATC::SetData(ATCData* d) {
-       _type = d->type;
-       _geod = d->geod;
-       _cart = d->cart;
-       range = d->range;
-       ident = d->ident;
-       name = d->name;
-       freq = d->freq;
+void FGATC::SetStation(flightgear::CommStation* sta) {
+    switch (sta->type()) {
+        case FGPositioned::FREQ_ATIS:   _type = ATIS; break;
+        case FGPositioned::FREQ_AWOS:   _type = AWOS; break;
+        default:
+        throw sg_exception("unsupported comm station type");
+    }
+    
+    _geod = sta->geod();
+    _cart = sta->cart();
+    range = sta->rangeNm();
+    ident = sta->airport()->ident();
+    name = sta->airport()->name();
+    freq = sta->freqKHz();
 }
 
 // Render a transmission
@@ -220,7 +226,7 @@ void FGATC::Render(string& msg, const float volume,
                                _sgr->add(simple, refname);
                                _sgr->play(refname, repeating);
                        } catch ( sg_io_exception &e ) {
-                               SG_LOG(SG_GENERAL, SG_ALERT, e.getFormattedMessage());
+                               SG_LOG(SG_ATC, SG_ALERT, e.getFormattedMessage());
                        }
                }
        }
@@ -294,7 +300,7 @@ std::istream& operator >> ( std::istream& fin, ATCData& a )
                a.type = INVALID;
                return fin >> skipeol;
        default:
-               SG_LOG(SG_GENERAL, SG_ALERT, "Warning - unknown type \'" << tp << "\' found whilst reading ATC frequency data!\n");
+               SG_LOG(SG_ATC, SG_ALERT, "Warning - unknown type \'" << tp << "\' found whilst reading ATC frequency data!\n");
                a.type = INVALID;
                return fin >> skipeol;
        }