]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/commlist.cxx
Modified Files:
[flightgear.git] / src / ATC / commlist.cxx
index a88ba3521eb3517247b0252945b58d2ae2af79a8..4d27e1c794fcde4ccca9f43e182f7306c7a9ee2e 100644 (file)
@@ -17,7 +17,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 
 #ifdef HAVE_CONFIG_H
@@ -50,7 +50,7 @@ FGCommList::~FGCommList( void ) {
 
 
 // load the navaids and build the map
-bool FGCommList::init( SGPath path ) {
+bool FGCommList::init( const SGPath& path ) {
 
        SGPath temp = path;
     commlist_freq.erase(commlist_freq.begin(), commlist_freq.end());
@@ -70,7 +70,7 @@ bool FGCommList::init( SGPath path ) {
 }
        
 
-bool FGCommList::LoadComms(SGPath path) {
+bool FGCommList::LoadComms(const SGPath& path) {
 
     sg_gzifstream fin( path.str() );
     if ( !fin.is_open() ) {
@@ -246,8 +246,8 @@ double FGCommList::FindClosest( double lon, double lat, double elev, ATCData& ad
                                ATCData ad2 = *itr;
                                //Point3D p1(*itr.lon, *itr.lat, *itr.elev);
                                Point3D p1(ad2.lon, ad2.lat, ad2.elev);
-                               FGAirport a;
-                               if(dclFindAirportID(ad2.ident, &a)) {
+                               const FGAirport *a = fgFindAirportID(ad2.ident);
+                               if (a) {
                                        Point3D p2(lon, lat, elev);
                                        tmp = dclGetHorizontalSeparation(p1, p2);
                                        if(tmp <= closest) {
@@ -272,11 +272,11 @@ double FGCommList::FindClosest( double lon, double lat, double elev, ATCData& ad
 // Find by Airport code.
 // This is basically a wrapper for a call to the airport database to get the airport
 // position followed by a call to FindByPos(...)
-bool FGCommList::FindByCode( string ICAO, ATCData& ad, atc_type tp ) {
-    FGAirport a;
-    if ( dclFindAirportID( ICAO, &a ) ) {
+bool FGCommList::FindByCode( const string& ICAO, ATCData& ad, atc_type tp ) {
+    const FGAirport *a = fgFindAirportID( ICAO);
+    if ( a) {
                comm_list_type stations;
-               int found = FindByPos(a._longitude, a._latitude, a._elevation, 10.0, &stations, tp);
+               int found = FindByPos(a->getLongitude(), a->getLatitude(), a->getElevation(), 10.0, &stations, tp);
                if(found) {
                        comm_list_iterator itr = stations.begin();
                        while(itr != stations.end()) {
@@ -296,7 +296,7 @@ bool FGCommList::FindByCode( string ICAO, ATCData& ad, atc_type tp ) {
 
 // TODO - this function should move somewhere else eventually!
 // Return an appropriate call-sign for an ATIS transmission.
-int FGCommList::GetCallSign( string apt_id, int hours, int mins )
+int FGCommList::GetCallSign( const string& apt_id, int hours, int mins )
 {
        atis_transmission_type tran;