X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAirports%2Fsimple.cxx;h=c31cce339a00305a40e2102e9e25e280db325d49;hb=485230b443de22c97d5c4ddfda98598fb52ce98a;hp=1e5d9a6940f87eb6b76e4acf03e6c02c9414b7e4;hpb=14a8533f636b7d4ad5d95cff30e4d46b42eb57ca;p=flightgear.git diff --git a/src/Airports/simple.cxx b/src/Airports/simple.cxx index 1e5d9a694..c31cce339 100644 --- a/src/Airports/simple.cxx +++ b/src/Airports/simple.cxx @@ -24,10 +24,12 @@ // $Id$ -#include +#include + +#include +#include +#include -#include -#include #include
#include STL_STRING @@ -46,13 +48,15 @@ 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; + FGPath path( current_options.get_fg_root() ); + path.append( "Airports" ); + path.append( file ); airports.erase( airports.begin(), airports.end() ); - fg_gzifstream in( path ); - if ( !in ) { - FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << path ); + fg_gzifstream in( path.str() ); + if ( !in.is_open() ) { + FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << path.str() ); exit(-1); } @@ -65,14 +69,29 @@ int fgAIRPORTS::load( const string& file ) { */ // read in each line of the file + +#ifdef __MWERKS__ + in >> skipcomment; - while ( ! in.eof() ) - { + char c = 0; + while ( in.get(c) && c != '\0' ) { + in.putback(c); + in >> a; + airports.insert(a); + in >> skipcomment; + } + +#else + + in >> skipcomment; + while ( ! in.eof() ) { in >> a; airports.insert(a); in >> skipcomment; } +#endif + return 1; }