From 7f6b697ea64a5acd62e5654c5f31d79aa6947598 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 27 Apr 1999 19:27:45 +0000 Subject: [PATCH] Changes for the MacOS port contributed by Darrell Walisser. --- Include/compiler.h | 4 ++- Include/fg_callback.hxx | 6 ++++ Lib/Bucket/newbucket.cxx | 2 +- Lib/Misc/fgpath.cxx | 23 ++++++++++-- Lib/Misc/fgpath.hxx | 13 +++++-- Simulator/Astro/moon.cxx | 15 ++++---- Simulator/Astro/stars.cxx | 17 +++++---- Simulator/Cockpit/Makefile.am | 3 +- Simulator/Cockpit/cockpit.cxx | 18 ++++++++-- Simulator/Cockpit/hud.hxx | 2 ++ Simulator/Cockpit/panel.cxx | 16 +++++---- Simulator/FDM/JSBsim.cxx | 13 ++++--- Simulator/FDM/LaRCsim/ls_interface.c | 8 +++-- Simulator/FDM/flight.cxx | 9 +++++ Simulator/Main/GLUTmain.cxx | 54 ++++++++++++++++++++++------ Simulator/Main/fg_init.cxx | 2 ++ Simulator/Main/options.cxx | 15 +++++++- Simulator/Main/splash.cxx | 15 ++++---- Simulator/Scenery/tilecache.cxx | 11 +++--- Simulator/Time/light.cxx | 18 ++++++---- Simulator/Time/timestamp.hxx | 5 +++ 21 files changed, 204 insertions(+), 65 deletions(-) diff --git a/Include/compiler.h b/Include/compiler.h index c00f4e0af..2b4b940d3 100644 --- a/Include/compiler.h +++ b/Include/compiler.h @@ -117,6 +117,9 @@ // -rp- please use FG_MEM_COPY everywhere ! # define FG_MEM_COPY(to,from,n) memcpy(to, from, n) +// -dw- currently used glut has no game mode stuff +# define GLUT_WRONG_VERSION + # elif (__MWERKS__ >= 0x0900) && __INTEL__ # error still to be supported... # else @@ -298,4 +301,3 @@ inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const) #endif // FG_INCOMPLETE_FUNCTIONAL #endif // _COMPILER_H - diff --git a/Include/fg_callback.hxx b/Include/fg_callback.hxx index 6b25102a7..e66e62580 100644 --- a/Include/fg_callback.hxx +++ b/Include/fg_callback.hxx @@ -22,6 +22,12 @@ #ifndef _FG_CALLBACK_HXX #define _FG_CALLBACK_HXX +// -dw- need size_t for params() function +#ifdef __MWERKS__ +typedef unsigned long size_t; +#endif + + //----------------------------------------------------------------------------- // // Abstract base class for all FlightGear callbacks. diff --git a/Lib/Bucket/newbucket.cxx b/Lib/Bucket/newbucket.cxx index fc41418a3..ff3c7b422 100644 --- a/Lib/Bucket/newbucket.cxx +++ b/Lib/Bucket/newbucket.cxx @@ -78,7 +78,7 @@ string FGBucket::gen_base_path() const { FGPath path( raw_path ); - return path.get_path(); + return path.str(); } diff --git a/Lib/Misc/fgpath.cxx b/Lib/Misc/fgpath.cxx index 732128186..a49c025ff 100644 --- a/Lib/Misc/fgpath.cxx +++ b/Lib/Misc/fgpath.cxx @@ -51,7 +51,7 @@ FGPath::FGPath() { // create a path based on "path" FGPath::FGPath( const string p ) { - path = fix_path( p ); + set( p ); } @@ -60,7 +60,13 @@ FGPath::~FGPath() { } -// append to the existing path +// set path +void FGPath::set( const string p ) { + path = fix_path( p ); +} + + +// append another piece to the existing path void FGPath::append( const string p ) { string part = fix_path( p ); @@ -73,3 +79,16 @@ void FGPath::append( const string p ) { path += part; } } + + +// concatenate a string to the end of the path without inserting a +// path separator +void FGPath::concat( const string p ) { + string part = fix_path( p ); + + if ( path.size() == 0 ) { + path = part; + } else { + path += part; + } +} diff --git a/Lib/Misc/fgpath.hxx b/Lib/Misc/fgpath.hxx index 801b45138..a3d3fc71e 100644 --- a/Lib/Misc/fgpath.hxx +++ b/Lib/Misc/fgpath.hxx @@ -60,12 +60,19 @@ public: // destructor ~FGPath(); - // append to the existing path + // set path + void set( const string p ); + + // append another piece to the existing path void append( const string p ); + // concatenate a string to the end of the path without inserting a + // path separator + void concat( const string p ); + // get the path string - inline string get_path() const { return path; } - inline const char *get_path_c_str() { return path.c_str(); } + inline string str() const { return path; } + inline const char *c_str() { return path.c_str(); } }; diff --git a/Simulator/Astro/moon.cxx b/Simulator/Astro/moon.cxx index 6c3e91bde..1c3029f5b 100644 --- a/Simulator/Astro/moon.cxx +++ b/Simulator/Astro/moon.cxx @@ -28,8 +28,9 @@ #include "moon.hxx" #include -#include #include
+#include +#include #ifdef __BORLANDC__ # define exception c_exception @@ -53,7 +54,6 @@ Moon::Moon(FGTime *t) : 0.054900, 0.000000, 115.3654, 13.0649929509, t) { - string tpath, fg_tpath; int width, height; FG_LOG( FG_GENERAL, FG_INFO, "Initializing Moon Texture"); @@ -72,18 +72,21 @@ Moon::Moon(FGTime *t) : glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // load in the texture data - tpath = current_options.get_fg_root() + "/Textures/" + "moon.rgb"; - + FGPath tpath( current_options.get_fg_root() ); + tpath.append( "Textures" ); + tpath.append( "moon.rgb" ); + if ( (moon_texbuf = read_rgb_texture(tpath.c_str(), &width, &height)) == NULL ) { // Try compressed - fg_tpath = tpath + ".gz"; + FGPath fg_tpath = tpath; + fg_tpath.append( ".gz" ); if ( (moon_texbuf = read_rgb_texture(fg_tpath.c_str(), &width, &height)) == NULL ) { FG_LOG( FG_GENERAL, FG_ALERT, - "Error in loading moon texture " << tpath ); + "Error in loading moon texture " << tpath.str() ); exit(-1); } } diff --git a/Simulator/Astro/stars.cxx b/Simulator/Astro/stars.cxx index 05bab930a..d26f71a48 100644 --- a/Simulator/Astro/stars.cxx +++ b/Simulator/Astro/stars.cxx @@ -51,10 +51,11 @@ #include #include #include +#include #include +#include #include
#include
-#include #include