From f2254bfbb786ced52ab9429c844b2d3f34b9d7f7 Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 2 Sep 1998 14:35:38 +0000 Subject: [PATCH] Rewrote simple airport loader so it can deal with comments and blank lines. --- Airports/simple.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Airports/simple.cxx b/Airports/simple.cxx index ffa093ba7..030f18214 100644 --- a/Airports/simple.cxx +++ b/Airports/simple.cxx @@ -38,12 +38,15 @@ #include STL_FUNCTIONAL #include STL_ALGORITHM + fgAIRPORTS::fgAIRPORTS() { } // load the data int fgAIRPORTS::load( const string& file ) { + fgAIRPORT a; + // build the path name to the airport file string path = current_options.get_fg_root() + "/Airports/" + file; StopWatch t; @@ -57,11 +60,21 @@ int fgAIRPORTS::load( const string& file ) { t.start(); + /* // We can use the STL copy algorithm because the input // file doesn't contain and comments or blank lines. copy( istream_iterator(in.stream()), istream_iterator(), inserter( airports, airports.begin() ) ); + */ + + // read in each line of the file + while ( ! in.eof() ) + { + in.eat_comments(); + in.stream() >> a.id >> a.longitude >> a.latitude >> a.elevation; + airports.insert(a); + } t.stop(); @@ -120,6 +133,9 @@ fgAIRPORTS::~fgAIRPORTS( void ) { // $Log$ +// Revision 1.5 1998/09/02 14:35:38 curt +// Rewrote simple airport loader so it can deal with comments and blank lines. +// // Revision 1.4 1998/09/01 19:02:53 curt // Changes contributed by Bernie Bright // - The new classes in libmisc.tgz define a stream interface into zlib. -- 2.39.2