]> git.mxchange.org Git - flightgear.git/commitdiff
Borland C++ tweaks.
authorcurt <curt>
Sun, 20 Jun 1999 01:52:31 +0000 (01:52 +0000)
committercurt <curt>
Sun, 20 Jun 1999 01:52:31 +0000 (01:52 +0000)
MacOS/Metrowerks tweaks.
Fix for fgText default constructor.

Lib/Bucket/newbucket.cxx
Lib/Misc/fgstream.cxx
Lib/XGL/xglUtils.c
Simulator/Airports/simple.cxx
Simulator/Cockpit/hud.hxx

index bb6f8bb9a2645013be3580c23df884abf479db59..20d980b927b2e8cdf49c85cc78b2d051e9d8b847 100644 (file)
@@ -28,6 +28,8 @@
 #endif
 
 
+#include <math.h>
+
 #include <Misc/fgpath.hxx>
 
 #include "newbucket.hxx"
index 3d5a09339e84108bc52e84c0455808205429262c..a7203de2cbbe626ae1f70e6694c6a483db93d8bc 100644 (file)
@@ -118,18 +118,29 @@ skipws( istream& in ) {
     while ( in.get(c) ) {
 
 #ifdef __MWERKS__
+
        // -dw- for unix file compatibility
        // -clo- this causes problems for unix
        if ( (c == '\n') || (c == '\r') || (c == '\0') ) {
            break;
-       }       
-#endif
+       }
+
+       if ( ! isspace( c ) && c != '\n' ) {
+           // put pack the non-space character
+           in.putback(c);
+           break;
+       }
+
+#else
 
        if ( ! isspace( c ) ) {
            // put pack the non-space character
            in.putback(c);
            break;
        }
+
+#endif
+
     }
     return in;
 }
index 56da165227b43fa15f7e76a05597b61f01b2820d..d781fa23fdcf2985428ea852acdad3e9edb1a23e 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#if !defined( __CYGWIN__ ) && !defined( __CYGWIN32__ )
+#if !defined( WIN32 )
 #  if !defined( HAVE_STL_SGI_PORT ) && !defined( __MWERKS__ )
 //   Avoid malloc with STLport and MSL
 #    include <malloc.h>
 
 int   xglTraceOn = TRUE ;
 
-#ifndef WIN32
-    FILE *xglTraceFd = stdout ;
-#else /* WIN32 */
-    /* Bail for now, we just want it to compile I guess */
-    FILE *xglTraceFd = NULL;
-#endif /* WIN32 */
+FILE *xglTraceFd = NULL;
 
 struct GLenumLookup
 {
index 1e5d9a6940f87eb6b76e4acf03e6c02c9414b7e4..f9411a198979d34005cc48ea2bb8dee7521699bd 100644 (file)
@@ -27,6 +27,7 @@
 #include <Include/compiler.h>
 
 #include <Debug/logstream.hxx>
+#include <Misc/fgpath.hxx>
 #include <Misc/fgstream.hxx>
 #include <Main/options.hxx>
 
@@ -46,13 +47,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 +68,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;
 }
 
index cb1c6afc321fd1929e8a7dc7019f5c4d6e00b6e7..079139e29a06116b10af2c136b06caa9ca57aaf8 100644 (file)
@@ -233,20 +233,10 @@ extern float HUD_matrix[16];
 
 class fgText {
 private:
-    char msg[32];
     float x, y;
+    char msg[32];
 public:
-    // note to Norman from Curt.  You had two constructors here that
-    // have defaults values for all parameters.  So, if a constructor
-    // is called with no parameters, which is chosen?  For the second,
-    // I've removed the default value for x which fixes the problem.
-    // However, it might be best to just delete the second redundant
-    // constructor, and fix the constructor variable ordering
-    // throughout the rest of the code.
-    fgText( char *c = NULL, float x = 0, float y =0 )
-        : x(x), y(y) {strncpy(msg,c,32-1);}
-
-    fgText( float x, float y = 0, char *c = NULL )
+    fgText( float x = 0, float y = 0, char *c = NULL )
         : x(x), y(y) {strncpy(msg,c,32-1);}
 
     fgText( const fgText & image )
@@ -441,7 +431,7 @@ class instr_item {  // An Abstract Base Class (ABC)
     }
     void TextString( char *msg, float x, float y )
     {
-        HUD_TextList.add(fgText(msg, x, y));        
+        HUD_TextList.add(fgText(x, y, msg));        
     }
     int getStringWidth ( char *str )
     {