1
0
Fork 0

Borland C++ tweaks.

MacOS/Metrowerks tweaks.
Fix for fgText default constructor.
This commit is contained in:
curt 1999-06-20 01:52:31 +00:00
parent 8a240d043d
commit 760ffc1aa6
5 changed files with 44 additions and 28 deletions

View file

@ -28,6 +28,8 @@
#endif #endif
#include <math.h>
#include <Misc/fgpath.hxx> #include <Misc/fgpath.hxx>
#include "newbucket.hxx" #include "newbucket.hxx"

View file

@ -118,18 +118,29 @@ skipws( istream& in ) {
while ( in.get(c) ) { while ( in.get(c) ) {
#ifdef __MWERKS__ #ifdef __MWERKS__
// -dw- for unix file compatibility // -dw- for unix file compatibility
// -clo- this causes problems for unix // -clo- this causes problems for unix
if ( (c == '\n') || (c == '\r') || (c == '\0') ) { if ( (c == '\n') || (c == '\r') || (c == '\0') ) {
break; break;
} }
#endif
if ( ! isspace( c ) && c != '\n' ) {
// put pack the non-space character
in.putback(c);
break;
}
#else
if ( ! isspace( c ) ) { if ( ! isspace( c ) ) {
// put pack the non-space character // put pack the non-space character
in.putback(c); in.putback(c);
break; break;
} }
#endif
} }
return in; return in;
} }

View file

@ -7,7 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if !defined( __CYGWIN__ ) && !defined( __CYGWIN32__ ) #if !defined( WIN32 )
# if !defined( HAVE_STL_SGI_PORT ) && !defined( __MWERKS__ ) # if !defined( HAVE_STL_SGI_PORT ) && !defined( __MWERKS__ )
// Avoid malloc with STLport and MSL // Avoid malloc with STLport and MSL
# include <malloc.h> # include <malloc.h>
@ -28,12 +28,7 @@
int xglTraceOn = TRUE ; int xglTraceOn = TRUE ;
#ifndef WIN32 FILE *xglTraceFd = NULL;
FILE *xglTraceFd = stdout ;
#else /* WIN32 */
/* Bail for now, we just want it to compile I guess */
FILE *xglTraceFd = NULL;
#endif /* WIN32 */
struct GLenumLookup struct GLenumLookup
{ {

View file

@ -27,6 +27,7 @@
#include <Include/compiler.h> #include <Include/compiler.h>
#include <Debug/logstream.hxx> #include <Debug/logstream.hxx>
#include <Misc/fgpath.hxx>
#include <Misc/fgstream.hxx> #include <Misc/fgstream.hxx>
#include <Main/options.hxx> #include <Main/options.hxx>
@ -46,13 +47,15 @@ int fgAIRPORTS::load( const string& file ) {
fgAIRPORT a; fgAIRPORT a;
// build the path name to the airport file // 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() ); airports.erase( airports.begin(), airports.end() );
fg_gzifstream in( path ); fg_gzifstream in( path.str() );
if ( !in ) { if ( !in.is_open() ) {
FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << path ); FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << path.str() );
exit(-1); exit(-1);
} }
@ -65,14 +68,29 @@ int fgAIRPORTS::load( const string& file ) {
*/ */
// read in each line of the file // read in each line of the file
#ifdef __MWERKS__
in >> skipcomment; in >> skipcomment;
while ( ! in.eof() ) char c = 0;
{ while ( in.get(c) && c != '\0' ) {
in.putback(c);
in >> a; in >> a;
airports.insert(a); airports.insert(a);
in >> skipcomment; in >> skipcomment;
} }
#else
in >> skipcomment;
while ( ! in.eof() ) {
in >> a;
airports.insert(a);
in >> skipcomment;
}
#endif
return 1; return 1;
} }

View file

@ -233,20 +233,10 @@ extern float HUD_matrix[16];
class fgText { class fgText {
private: private:
char msg[32];
float x, y; float x, y;
char msg[32];
public: public:
// note to Norman from Curt. You had two constructors here that fgText( float x = 0, float y = 0, char *c = NULL )
// 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 )
: x(x), y(y) {strncpy(msg,c,32-1);} : x(x), y(y) {strncpy(msg,c,32-1);}
fgText( const fgText & image ) fgText( const fgText & image )
@ -441,7 +431,7 @@ class instr_item { // An Abstract Base Class (ABC)
} }
void TextString( char *msg, float x, float y ) 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 ) int getStringWidth ( char *str )
{ {