]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/simple.cxx
Code reorganization.
[flightgear.git] / src / Airports / simple.cxx
index 1e5d9a6940f87eb6b76e4acf03e6c02c9414b7e4..c31cce339a00305a40e2102e9e25e280db325d49 100644 (file)
 // $Id$
 
 
-#include <Include/compiler.h>
+#include <simgear/compiler.h>
+
+#include <simgear/logstream.hxx>
+#include <simgear/fgpath.hxx>
+#include <simgear/fgstream.hxx>
 
-#include <Debug/logstream.hxx>
-#include <Misc/fgstream.hxx>
 #include <Main/options.hxx>
 
 #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;
 }