]> git.mxchange.org Git - flightgear.git/commitdiff
Tweaks to handle latest airport data file from Robin Peel.
authorcurt <curt>
Wed, 20 Sep 2000 23:26:17 +0000 (23:26 +0000)
committercurt <curt>
Wed, 20 Sep 2000 23:26:17 +0000 (23:26 +0000)
src/Airports/Makefile.am
src/Airports/genrunways.cxx
src/Airports/simple.cxx
src/Airports/simple.hxx

index 9fcdb33e4a8fc2b114552a82059b6a435b8b1be5..5a28f071012f9150168eadba0aecfe0b6e7e77bb 100644 (file)
@@ -12,4 +12,4 @@ gensimple_LDADD = libAirports.a -lsgdebug -lsgmisc -lmk4 -lz
 genrunways_SOURCES = genrunways.cxx
 genrunways_LDADD = libAirports.a -lsgdebug -lsgmisc -lmk4 -lz
 
-INCLUDES += -I$(top_builddir) -I$(top_builddir)/src
+INCLUDES += -I$(top_srcdir) -I$(top_srcdir)/src
index 97516eab018917df58dd8dc07106e7cb34c15711..d81f7474ceb97378078f570fab63dff7327d0294 100644 (file)
@@ -11,6 +11,7 @@ int main( int argc, char **argv ) {
        runways.dump_mk4( argv[2] );    
     } else {
        cout << "usage: " << argv[0] << " <in> <out>" << endl;
+       exit(-1);
     }
 
     cout << endl;
index 70c59ba9447e4c2a5649f257e580150e15dbf8d3..6915132c72d84dc3ccfde2669c2f56f234842f3a 100644 (file)
@@ -125,34 +125,47 @@ int FGAirportsUtil::load( const string& file ) {
        exit(-1);
     }
 
-    /*
-    // We can use the STL copy algorithm because the input
-    // file doesn't contain and comments or blank lines.
-    copy( istream_iterator<FGAirport,ptrdiff_t>(in.stream()),
-         istream_iterator<FGAirport,ptrdiff_t>(),
-         inserter( airports, airports.begin() ) );
-    */
+    // skip first line of file
+    char tmp[256];
+    in.getline( tmp, 256 );
+
 
     // read in each line of the file
 
 #ifdef __MWERKS__
 
-    in >> skipcomment;
+    in >> ::skipws;
     char c = 0;
     while ( in.get(c) && c != '\0' ) {
-       in.putback(c);
-       in >> a;
-       airports.insert(a);
-       in >> skipcomment;
+       if ( c == 'A' ) {
+           in >> a;
+           in >> skipeol;
+           airports.insert(a);
+       } else if ( c == 'R' ) {
+           in >> skipeol;
+       } else {
+           in >> skipeol;
+       }
+       in >> ::skipws;
     }
 
 #else
 
-    in >> skipcomment;
+    in >> skipws;
     while ( ! in.eof() ) {
-       in >> a;
-       airports.insert(a);
-       in >> skipcomment;
+       char c = 0;
+       in.get(c);
+       if ( c == 'A' ) {
+           in >> a;
+           cout << "in <- " << a.id << endl;
+           in >> skipeol;
+           airports.insert(a);
+       } else if ( c == 'R' ) {
+           in >> skipeol;
+       } else {
+           in >> skipeol;
+       }
+       in >> skipws;
     }
 
 #endif
@@ -185,6 +198,7 @@ bool FGAirportsUtil::dump_mk4( const string& file ) {
     const_iterator end = airports.end();
     while ( current != end ) {
        // add each airport record
+       cout << "out -> " << current->id << endl;
        pID (row) = current->id.c_str();
        pLon (row) = current->longitude;
        pLat (row) = current->latitude;
index 2de3535dc88218703a9cc3aa92a1878906eb63f7..a3c75799356e85008c827a5b80481e239166b925 100644 (file)
@@ -94,7 +94,7 @@ public:
 inline istream&
 operator >> ( istream& in, FGAirport& a )
 {
-    return in >> a.id >> a.longitude >> a.latitude >> a.elevation;
+    return in >> a.id >> a.latitude >> a.longitude >> a.elevation;
 }