From 412ca9a3d4c5cb698f3234aa183c0e2af2a88de2 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 30 Mar 2002 12:50:30 +0000 Subject: [PATCH] * src/ATC/atis.cxx * src/ATC/atislist.cxx Patch from Melchior Franz: - merged the _MWERKS_ & generic #ifdef branch, only the loop head needs different treatment - commented out a "n >> skipeol" that is used in navlist.cxx to gobble the starting C++-style comment from default.nav.gz; atis inherited that, but there is no such comment in default.atis.gz, so the first data entry got thrown away - commented out min/max frequency exploration (-> only for debugging) - enhanced the constructor; the operator>> wouldn't have initialized all variables in case of a broken default.atis.gz entry, so we would have got a mixture of the broken one and the previous one; - move the automatic FGATIS variable into the loop, so that it gets cleanly constructed for every database entry. - don't access a.type before it is initialized - updated the commented out debug output statements; they were still designed for the FGNav class ... --- src/ATC/atis.cxx | 19 ++++++++++++---- src/ATC/atislist.cxx | 54 ++++++++++++++++++++------------------------ 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/src/ATC/atis.cxx b/src/ATC/atis.cxx index 72558d284..8c1be3ce4 100644 --- a/src/ATC/atis.cxx +++ b/src/ATC/atis.cxx @@ -90,10 +90,21 @@ string GetPhoneticIdent(int i) { } // Constructor -FGATIS::FGATIS() { - transmission = ""; - display = false; - displaying = false; +FGATIS::FGATIS() + : type(0), + lon(0.0), lat(0.0), + elev(0.0), + x(0.0), y(0.0), z(0.0), + freq(0), + range(0), + display(false), + displaying(false), + ident(""), + name(""), + transmission(""), + trans_ident(""), + atis_failed(false) +{ } // Destructor diff --git a/src/ATC/atislist.cxx b/src/ATC/atislist.cxx index a38e3cf7c..1245dad32 100644 --- a/src/ATC/atislist.cxx +++ b/src/ATC/atislist.cxx @@ -47,7 +47,6 @@ FGATISList::~FGATISList( void ) { // load the navaids and build the map bool FGATISList::init( SGPath path ) { - FGATIS a; atislist.erase( atislist.begin(), atislist.end() ); @@ -59,55 +58,50 @@ bool FGATISList::init( SGPath path ) { // read in each line of the file - in >> skipeol; + // in >> skipeol; in >> skipcomment; + // double min = 100000; + // double max = 0; + #ifdef __MWERKS__ - char c = 0; - while ( in.get(c) && c != '\0' && a.get_type() != '[' ) { + while ( in.get(c) && c != '\0' ) { in.putback(c); - in >> a; - if ( a.get_type() != '[' ) { - atislist[a.get_freq()].push_back(a); - } - in >> skipcomment; - } - #else - - double min = 100000; - double max = 0; - - while ( ! in.eof() && a.get_type() != '[' ) { + while ( ! in.eof() ) { +#endif + + FGATIS a; in >> a; - //cout << "id = " << a.get_ident() << endl; - //cout << " type = " << a.get_type() << endl; - //cout << " lon = " << a.get_lon() << endl; - //cout << " lat = " << a.get_lat() << endl; - //cout << " elev = " << a.get_elev() << endl; - //cout << " freq = " << a.get_freq() << endl; - //cout << " range = " << a.get_range() << endl; - if ( a.get_type() != '[' ) { - atislist[a.get_freq()].push_back(a); - } + if ( a.get_type() == '[' ) { + break; + } + + /* cout << "id = " << a.GetIdent() << endl; + cout << " type = " << a.get_type() << endl; + cout << " lon = " << a.get_lon() << endl; + cout << " lat = " << a.get_lat() << endl; + cout << " elev = " << a.get_elev() << endl; + cout << " freq = " << a.get_freq() << endl; + cout << " range = " << a.get_range() << endl << endl; */ + + atislist[a.get_freq()].push_back(a); in >> skipcomment; - if ( a.get_type() != 'N' ) { + /* if ( a.get_type() != 'N' ) { if ( a.get_freq() < min ) { min = a.get_freq(); } if ( a.get_freq() > max ) { max = a.get_freq(); } - } + } */ } // cout << "min freq = " << min << endl; // cout << "max freq = " << max << endl; -#endif - return true; }