Borland C++ tweaks.
MacOS/Metrowerks tweaks. Fix for fgText default constructor.
This commit is contained in:
parent
8a240d043d
commit
760ffc1aa6
5 changed files with 44 additions and 28 deletions
|
@ -28,6 +28,8 @@
|
|||
#endif
|
||||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <Misc/fgpath.hxx>
|
||||
|
||||
#include "newbucket.hxx"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
@ -28,12 +28,7 @@
|
|||
|
||||
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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue