]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATCDCL/ATCDialog.cxx
Initial commit of the new sound system, expect more updates to follow
[flightgear.git] / src / ATCDCL / ATCDialog.cxx
index 5e548667ea999a88ef6aea4febbbfd8d5207a6e9..f094b1170cc82893a419028af4a11e132cd890ce 100644 (file)
@@ -66,7 +66,7 @@ ATCMenuEntry::ATCMenuEntry() {
 ATCMenuEntry::~ATCMenuEntry() {
 }
 
-static void atcUppercase(string &s) {
+void atcUppercase(string &s) {
        for(unsigned int i=0; i<s.size(); ++i) {
                s[i] = toupper(s[i]);
        }
@@ -266,7 +266,7 @@ void FGATCDialog::PopupCallback(int num) {
                //cout << "TOWER " << endl;
                //cout << "ident is " << atcptr->get_ident() << endl;
                atcmentry_vec_type atcmlist = (available_dialog[TOWER])[atcptr->get_ident()];
-               unsigned int size = atcmlist.size();
+               int size = atcmlist.size();
                if(size && num < size) {
                        //cout << "Doing callback...\n";
                        ATCMenuEntry a = atcmlist[num];
@@ -318,21 +318,19 @@ void FGATCDialog::FreqDialog() {
        // Find the ATC stations within a reasonable range
        comm_list_type atc_stations;
        comm_list_iterator atc_stat_itr;
-       
-       double lon = fgGetDouble("/position/longitude-deg");
-       double lat = fgGetDouble("/position/latitude-deg");
-       double elev = fgGetDouble("/position/altitude-ft");
-       SGVec3d aircraft = SGVec3d::fromGeod(SGGeod::fromDegM(lon, lat, elev));
+
+  SGGeod geod(SGGeod::fromDegFt(fgGetDouble("/position/longitude-deg"),
+    fgGetDouble("/position/latitude-deg"), fgGetDouble("/position/altitude-ft")));
+       SGVec3d aircraft = SGVec3d::fromGeod(geod);
 
        // search stations in range
-       int num_stat = current_commlist->FindByPos(lon, lat, elev, 50.0, &atc_stations);
+       int num_stat = current_commlist->FindByPos(geod, 50.0, &atc_stations);
        if (num_stat != 0) {
                map<atcdata, bool> uniq;
                // fill map (sorts by distance and removes duplicates)
                comm_list_iterator itr = atc_stations.begin();
                for (; itr != atc_stations.end(); ++itr) {
-                       SGVec3d station(itr->x, itr->y, itr->z);
-                       double distance = distSqr(aircraft, station);
+                       double distance = distSqr(aircraft, itr->cart);
                        uniq[atcdata(itr->ident, itr->name, distance)] = true;
                }
                // create button per map entry (modified copy of <button-template>)
@@ -382,7 +380,7 @@ void FGATCDialog::FreqDisplay(string& ident) {
        int n = 0;      // Number of ATC frequencies at this airport
 
        comm_list_type stations;
-       int found = current_commlist->FindByPos(a->getLongitude(), a->getLatitude(), a->getElevation(), 20.0, &stations);
+       int found = current_commlist->FindByPos(a->geod(), 20.0, &stations);
        if(found) {
                ostringstream ostr;
                comm_list_iterator itr = stations.begin();