]> git.mxchange.org Git - flightgear.git/commitdiff
Changes for the MacOS port contributed by Darrell Walisser.
authorcurt <curt>
Tue, 27 Apr 1999 19:27:45 +0000 (19:27 +0000)
committercurt <curt>
Tue, 27 Apr 1999 19:27:45 +0000 (19:27 +0000)
21 files changed:
Include/compiler.h
Include/fg_callback.hxx
Lib/Bucket/newbucket.cxx
Lib/Misc/fgpath.cxx
Lib/Misc/fgpath.hxx
Simulator/Astro/moon.cxx
Simulator/Astro/stars.cxx
Simulator/Cockpit/Makefile.am
Simulator/Cockpit/cockpit.cxx
Simulator/Cockpit/hud.hxx
Simulator/Cockpit/panel.cxx
Simulator/FDM/JSBsim.cxx
Simulator/FDM/LaRCsim/ls_interface.c
Simulator/FDM/flight.cxx
Simulator/Main/GLUTmain.cxx
Simulator/Main/fg_init.cxx
Simulator/Main/options.cxx
Simulator/Main/splash.cxx
Simulator/Scenery/tilecache.cxx
Simulator/Time/light.cxx
Simulator/Time/timestamp.hxx

index c00f4e0af8ae46c4af9cb2ac8be6f4754f5b5f8c..2b4b940d3b0f52edf7f5560a3087e946f3288033 100644 (file)
 // -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
-
index 6b25102a78aceaea8b0f2aec7869694f76403dae..e66e62580f824f4c5992841bd64df12a05a7c057 100644 (file)
 #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.
index fc41418a3b3632d0132f102852a3fb7daf0a9fed..ff3c7b4221e74f8cdc588c24b402f846633889eb 100644 (file)
@@ -78,7 +78,7 @@ string FGBucket::gen_base_path() const {
 
     FGPath path( raw_path );
 
-    return path.get_path();
+    return path.str();
 }
 
 
index 73212818646c9d10c7ec60905f1b9d5b1199675b..a49c025ffa6e3ab0a61be989bc7369af78d843cf 100644 (file)
@@ -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;
+    }
+}
index 801b451387feeecc466db04cfed0b7e3d94f55ac..a3d3fc71ea4eb7484ea28d21725905339c73770c 100644 (file)
@@ -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(); }
 };
 
 
index 6c3e91bdebdca19da144a35b92b445d7dad8cb4c..1c3029f5b0753c2594b883698e36987883daf529 100644 (file)
@@ -28,8 +28,9 @@
 #include "moon.hxx"
 
 #include <Debug/logstream.hxx>
-#include <Objects/texload.h>
 #include <Main/options.hxx>
+#include <Misc/fgpath.hxx>
+#include <Objects/texload.h>
 
 #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);
     } 
   } 
index 05bab930a52a6730a5597298df33f1fc767d5fac..d26f71a4837237e7cd90611c63b2c98deb88138b 100644 (file)
 #include <Aircraft/aircraft.hxx>
 #include <Debug/logstream.hxx>
 #include <Include/fg_constants.h>
+#include <Misc/fgpath.hxx>
 #include <Misc/fgstream.hxx>
+#include <Misc/stopwatch.hxx>
 #include <Main/options.hxx>
 #include <Main/views.hxx>
-#include <Misc/stopwatch.hxx>
 #include <Time/fg_time.hxx>
 #include "Misc/stopwatch.hxx"
 
@@ -72,7 +73,9 @@ static GLint stars[FG_STAR_LEVELS];
 
 // Initialize the Star Management Subsystem
 int fgStarsInit( void ) {
-    Point3D starlist[FG_MAX_STARS];
+    // -dw- avoid local data > 32k error by dynamic allocation of the
+    // array, problem for some compilers
+    Point3D *starlist = new Point3D[FG_MAX_STARS];
     // struct CelestialCoord pltPos;
     double right_ascension, declination, magnitude;
     double min_magnitude[FG_STAR_LEVELS];
@@ -88,13 +91,13 @@ int fgStarsInit( void ) {
     }
 
     // build the full path name to the stars data base file
-    string path = current_options.get_fg_root() + "/Astro/stars" + ".gz";
-
-    FG_LOG( FG_ASTRO, FG_INFO, "  Loading stars from " << path );
+    FGPath path ( current_options.get_fg_root() );
+    path.append( "Astro/stars" );
+    FG_LOG( FG_ASTRO, FG_INFO, "  Loading stars from " << path.str() );
 
-    fg_gzifstream in( path );
+    fg_gzifstream in( path.str() );
     if ( ! in ) {
-       FG_LOG( FG_ASTRO, FG_ALERT, "Cannot open star file: " << path );
+       FG_LOG( FG_ASTRO, FG_ALERT, "Cannot open star file: " << path.str() );
        exit(-1);
     }
 
index 4f16955e6eefd186e72379f4cca27ed5e6e2dd63..4066624e67237d0737211e3e2a261c8d72b070d4 100644 (file)
@@ -4,7 +4,8 @@ libCockpit_a_SOURCES = \
        cockpit.cxx cockpit.hxx \
        hud.cxx hud.hxx \
        hud_card.cxx hud_dnst.cxx hud_guag.cxx hud_inst.cxx \
-       hud_labl.cxx hud_ladr.cxx hud_scal.cxx hud_tbi.cxx \
+       hud_labl.cxx hud_ladr.cxx \
+       hud_scal.cxx hud_tbi.cxx \
        panel.cxx panel.hxx
 
 INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator
index baecd7f10fd21c761f036182ab8b2a352c7481bb..1fddd8f0fc35bde043919d0adc46d19b9b2b7ddf 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <Aircraft/aircraft.hxx>
 #include <Debug/logstream.hxx>
+#include <GUI/gui.h>
 #include <Include/fg_constants.h>
 #include <Include/general.hxx>
 #include <Main/options.hxx>
@@ -46,6 +47,7 @@
 #include <Math/mat3.h>
 #include <Math/polar3d.hxx>
 #include <Scenery/scenery.hxx>
+#include <Time/fg_time.hxx>
 #include <Time/fg_timer.hxx>
 
 #include "cockpit.hxx"
@@ -63,8 +65,7 @@ static pCockpit ac_cockpit;
 
 double get_latitude( void )
 {
-    return((double)((int)( current_aircraft.fdm_state->get_Latitude() 
-                          * RAD_TO_DEG)) );
+    return (double)((int)(current_aircraft.fdm_state->get_Latitude()*RAD_TO_DEG));
 }
 
 double get_lat_min( void )
@@ -97,6 +98,19 @@ double get_long_min( void )
     return( (a - d) * 60.0);
 }
 
+char*
+get_formated_gmt_time( void )
+{
+    static char buf[32];
+    FGTime *t = FGTime::cur_time_params;
+    const struct tm *p = t->getGmt();
+    sprintf( buf, "%d/%d/%2d %d:%02d:%02d", 
+            p->tm_mon+1, p->tm_mday, p->tm_year,
+            p->tm_hour, p->tm_min, p->tm_sec);
+    return buf;
+}
+
+
 double get_throttleval( void )
 {
     return controls.get_throttle( 0 );     // Hack limiting to one engine
index 03a73d6c861a1e7b903d0693f356d411fab35516..b40f9e0421fb2ca26f9b004384fffed798ce9839 100644 (file)
@@ -45,6 +45,7 @@
 #endif
 
 #include <deque>        // STL double ended queue
+#include <vector>       // STL vector
 
 #include <fg_typedefs.h>
 #include <fg_constants.h>
@@ -53,6 +54,7 @@
 #include <Controls/controls.hxx>
 
 FG_USING_STD(deque);
+FG_USING_STD(vector);
 
 #ifndef WIN32
   typedef struct {
index af96564d11e747555cbfb6fbcea70861972f56ba..37a8a59b5367870869ea7463c5694e85055a4f35 100644 (file)
@@ -44,6 +44,7 @@
 #include <Aircraft/aircraft.hxx>
 #include <Main/options.hxx>
 #include <Main/views.hxx>
+#include <Misc/fgpath.hxx>
 #include <Objects/texload.h>
 
 #include "panel.hxx"
@@ -80,13 +81,11 @@ FGPanel* FGPanel::OurPanel = 0;
 
 // FGPanel::FGPanel() - constructor to initialize the panel.                 
 FGPanel::FGPanel(void){
-
-    string tpath;
     int x, y;
     FILE *f;
     char line[256];
     GLint test;
-    GLubyte tex[262144];
+    GLubyte *tex = new GLubyte[262144];
 
 OurPanel = this;   
 
@@ -133,18 +132,21 @@ test_instr[2] = new FGTexInstrument(462.5, 133, 10, 20, 5.5, 60, 0.0, 1.0,
     // load in the texture data 
     
     xglPixelStorei(GL_UNPACK_ROW_LENGTH, 256);
-    tpath = current_options.get_fg_root() + "/Textures/gauges.rgb";
+    FGPath tpath( current_options.get_fg_root() );
+    tpath.append( "Textures/gauges.rgb" );
     if((img = read_rgb_texture( (char *)tpath.c_str(), &img_width,                      &img_height ))==NULL){
     }
 
     xglPixelStorei(GL_UNPACK_ROW_LENGTH, 256);
-    tpath = current_options.get_fg_root() + "/Textures/gauges2.rgb";
+    tpath.set( current_options.get_fg_root() );
+    tpath.append( "Textures/gauges2.rgb" );
     if((imag = read_rgb_texture( (char *)tpath.c_str(), &imag_width,                     &imag_height ))==NULL){
     }
 
     xglPixelStorei(GL_UNPACK_ROW_LENGTH, 1024);
 
-    tpath = current_options.get_fg_root() + "/Textures/Fullone.rgb";
+    tpath.set( current_options.get_fg_root() );
+    tpath.append( "Textures/Fullone.rgb" );
     if ((background = read_rgb_texture( (char *)tpath.c_str(), &width,                         &height ))==NULL ){
         }
 
@@ -227,7 +229,7 @@ void FGPanel::ReInit( int x, int y, int finx, int finy){
     xglDrawPixels(finx - x, finy - y, GL_RGB, GL_UNSIGNED_BYTE,                     (GLvoid *)(background));
 
     // restore original buffer state
-    xglDrawBuffer( buffer );
+    xglDrawBuffer( (GLenum)buffer );
     xglEnable(GL_DEPTH_TEST);
 }
 
index 85933fb02ee3cd3742fe4e56eff889953f855357..0f8dc9eef991ff5446a45c7a272480ac36fd9f47 100644 (file)
@@ -31,6 +31,7 @@
 #include <Include/fg_constants.h>
 #include <Main/options.hxx>
 #include <Math/fg_geodesy.hxx>
+#include <Misc/fgpath.hxx>
 
 #include <FDM/JSBsim/FGFDMExec.h>
 #include <FDM/JSBsim/FGAircraft.h>
@@ -54,13 +55,17 @@ int fgJSBsimInit(double dt) {
 
     FG_LOG( FG_FLIGHT, FG_INFO, "  created FDMExec" );
 
-    string aircraft_path = current_options.get_fg_root() + "/Aircraft";
-    string engine_path = current_options.get_fg_root() + "/Engine";
+    FGPath aircraft_path( current_options.get_fg_root() );
+    aircraft_path.append( "Aircraft" );
 
-    FDMExec.GetAircraft()->LoadAircraft(aircraft_path, engine_path, "X15");
+    FGPath engine_path( current_options.get_fg_root() );
+    engine_path.append( "Engine" );
+
+    FDMExec.GetAircraft()->LoadAircraft(aircraft_path.str(), 
+                                       engine_path.str(), "X15");
     FG_LOG( FG_FLIGHT, FG_INFO, "  loaded aircraft" );
 
-    FDMExec.GetState()->Reset(aircraft_path, "Reset00");
+    FDMExec.GetState()->Reset(aircraft_path.str(), "Reset00");
     FG_LOG( FG_FLIGHT, FG_INFO, "  loaded initial conditions" );
 
     FDMExec.GetState()->Setdt(dt);
index 532e9accbdb22864a4c30cf7341878c21371e381..ed8c19da0400642cf00f124ef175aebc673cbb0c 100644 (file)
@@ -231,6 +231,7 @@ $Original log: LaRCsim.c,v $
 
 #include "ls_types.h"
 #include "ls_constants.h"
+#include "ls_geodesy.h"
 #include "ls_generic.h"
 #include "ls_sim_control.h"
 #include "ls_cockpit.h"
@@ -574,8 +575,11 @@ int ls_ForceAltitude(double alt_feet) {
 /* Flight Gear Modification Log
  *
  * $Log$
- * Revision 1.1  1999/04/05 21:32:45  curt
- * Initial revision
+ * Revision 1.2  1999/04/27 19:28:04  curt
+ * Changes for the MacOS port contributed by Darrell Walisser.
+ *
+ * Revision 1.1.1.1  1999/04/05 21:32:45  curt
+ * Start of 0.6.x branch.
  *
  * Revision 1.25  1999/01/19 20:57:02  curt
  * MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
index 2b01e542870156183d9581eaf9d32499e3f46c62..530b7ae6e131d9d72b9b38e74237a2f73b24ea40 100644 (file)
@@ -47,7 +47,12 @@ FGInterface base_fdm_state;
 // Extrapolate fdm based on time_offset (in usec)
 void FGInterface::extrapolate( int time_offset ) {
     double dt = time_offset / 1000000.0;
+
+    // -dw- metrowerks complains about ambiguous access, not critical
+    // to keep this ;)
+#ifndef __MWERKS__
     cout << "extrapolating FDM by dt = " << dt << endl;
+#endif
 
     double lat = geodetic_position_v[0] + geocentric_rates_v[0] * dt;
     double lat_geoc = geocentric_position_v[0] + geocentric_rates_v[0] * dt;
@@ -79,9 +84,11 @@ int fgFDMInit(int model, FGInterface& f, double dt) {
 
     if ( model == FGInterface::FG_SLEW ) {
        // fgSlewInit(dt);
+#ifndef __MWERKS__   // -dw- 04/22/99 JSB sim not ported yet
     } else if ( model == FGInterface::FG_JSBSIM ) {
        fgJSBsimInit(dt);
        fgJSBsim_2_FGInterface(base_fdm_state);
+#endif
     } else if ( model == FGInterface::FG_LARCSIM ) {
        // lets try to avoid really screwing up the LaRCsim model
        if ( base_fdm_state.get_Altitude() < -9000.0 ) {
@@ -135,9 +142,11 @@ int fgFDMUpdate(int model, FGInterface& f, int multiloop, int time_offset) {
 
     if ( model == FGInterface::FG_SLEW ) {
        // fgSlewUpdate(f, multiloop);
+#ifndef __MWERKS__   // -dw- 04/22/99 JSB sim not ported yet
     } else if ( model == FGInterface::FG_JSBSIM ) {
        fgJSBsimUpdate(base_fdm_state, multiloop);
        f = base_fdm_state;
+#endif
     } else if ( model == FGInterface::FG_LARCSIM ) {
        fgLaRCsimUpdate(base_fdm_state, multiloop);
        // extrapolate position based on actual time
index ab471a7e5e0089de7b458a3a95ec30dd868d976d..1e5a9a8436e5acb2fe62c9a5905d7f088b0cd894 100644 (file)
@@ -71,6 +71,7 @@
 #include <Math/mat3.h>
 #include <Math/polar3d.hxx>
 #include <Math/fg_random.h>
+#include <Misc/fgpath.hxx>
 #include <plib/pu.h>
 #include <Scenery/scenery.hxx>
 #include <Scenery/tilemgr.hxx>
 #include "fg_serial.hxx"
 
 
+// -dw- use custom sioux settings so I can see output window
+#ifdef MACOS
+#  ifndef FG_NDEBUG
+#    include <sioux.h> // settings for output window
+#  endif
+#endif
+
+
 // This is a record containing a bit of global housekeeping information
 FGGeneral general;
 
@@ -137,10 +146,12 @@ static void fgInitVisuals( void ) {
 
     l = &cur_light_params;
 
+#ifndef GLUT_WRONG_VERSION
     // Go full screen if requested ...
     if ( current_options.get_fullscreen() ) {
        glutFullScreen();
     }
+#endif
 
     // If enabled, normal vectors specified with glNormal are scaled
     // to unit length after transformation.  See glNormal.
@@ -554,8 +565,10 @@ static void fgMainLoop( void ) {
        }
     }
 
+#if ! defined( MACOS )
     // Do any serial port work that might need to be done
     fgSerialProcess();
+#endif
 
     // see if we need to load any new scenery tiles
     fgTileMgrUpdate();
@@ -660,12 +673,14 @@ static void fgIdleFunction ( void ) {
 #if !defined(WIN32)
        if ( current_options.get_intro_music() ) {
            string lockfile = "/tmp/mpg123.running";
-           string mp3file = current_options.get_fg_root() +
-               "/Sounds/intro.mp3";
-           string command = "(touch " + lockfile + "; mpg123 " + mp3file +
-                "> /dev/null 2>&1; /bin/rm " + lockfile + ") &";
+           FGPath mp3file( current_options.get_fg_root() );
+           mp3file.append( "Sounds/intro.mp3" );
+
+           string command = "(touch " + lockfile + "; mpg123 "
+               + mp3file.str() + "> /dev/null 2>&1; /bin/rm "
+               + lockfile + ") &";
            FG_LOG( FG_GENERAL, FG_INFO, 
-                   "Starting intro music: " << mp3file );
+                   "Starting intro music: " << mp3file.str() );
            system ( command.c_str() );
        }
 #endif
@@ -733,7 +748,9 @@ static void fgIdleFunction ( void ) {
        audio_mixer = new smMixer;
        audio_mixer -> setMasterVolume ( 80 ) ;  /* 80% of max volume. */
        audio_sched -> setSafetyMargin ( 1.0 ) ;
-       string slfile = current_options.get_fg_root() + "/Sounds/wasp.wav";
+
+       FGPath slfile( current_options.get_fg_root() );
+       slfile.append( "Sounds/wasp.wav" );
 
        s1 = new slSample ( (char *)slfile.c_str() );
        FG_LOG( FG_GENERAL, FG_INFO,
@@ -831,6 +848,7 @@ int fgGlutInit( int *argc, char **argv ) {
     if ( current_options.get_game_mode() == 0 ) {
        // Open the regular window
        xglutCreateWindow("Flight Gear");
+#ifndef GLUT_WRONG_VERSION
     } else {
        // Open the cool new 'game mode' window
        char game_mode_str[256];
@@ -842,6 +860,7 @@ int fgGlutInit( int *argc, char **argv ) {
                "game mode params = " << game_mode_str );
        glutGameModeString( game_mode_str );
        glutEnterGameMode();
+#endif
     }
 
     // This seems to be the absolute earliest in the init sequence
@@ -920,6 +939,18 @@ int fgGlutInitEvents( void ) {
 
 // Main ...
 int main( int argc, char **argv ) {
+#ifdef MACOS
+#  ifndef FG_NDEBUG
+
+    // -dw- this will not work unless called before any standard
+    // output, so why not put it here?
+    SIOUXSettings.toppixel = 540;
+    SIOUXSettings.leftpixel = 50;
+    SIOUXSettings.rows = 15;
+
+#  endif
+#endif
+
     FGInterface *f;
 
     f = current_aircraft.fdm_state;
@@ -943,15 +974,16 @@ int main( int argc, char **argv ) {
 
     // Attempt to locate and parse a config file
     // First check fg_root
-    string config = current_options.get_fg_root() + "/system.fgfsrc";
-    current_options.parse_config_file( config );
+    FGPath config( current_options.get_fg_root() );
+    config.append( "system.fgfsrc" );
+    current_options.parse_config_file( config.str() );
 
     // Next check home directory
     char* envp = ::getenv( "HOME" );
     if ( envp != NULL ) {
-       config = envp;
-       config += "/.fgfsrc";
-       current_options.parse_config_file( config );
+       config.set( envp );
+       config.append( ".fgfsrc" );
+       current_options.parse_config_file( config.str() );
     }
 
     // Parse remaining command line options
index e192fbda7546ee9a9c2e6a4501babecca292ed80..3da8f3d8c30fac52aaaedb7025def7e0efe36862 100644 (file)
@@ -411,7 +411,9 @@ int fgInitSubsystems( void )
     fgAPInit(&current_aircraft);
 
     // Initialize serial ports
+#if ! defined( MACOS )
     fgSerialInit();
+#endif
 
     FG_LOG( FG_GENERAL, FG_INFO, endl);
 
index 79f36df3289a81999ce0055beeef10d9e178fb22..1cae1dccbe21d67929b64230a16e71fafd6cf52c 100644 (file)
@@ -54,13 +54,24 @@ FG_USING_NAMESPACE(std);
 inline double
 atof( const string& str )
 {
+
+#ifdef __MWERKS__ 
+    // -dw- if ::atof is called, then we get an infinite loop
+    return std::atof( str.c_str() );
+#else
     return ::atof( str.c_str() );
+#endif
 }
 
 inline int
 atoi( const string& str )
 {
+#ifdef __MWERKS__ 
+    // -dw- if ::atoi is called, then we get an infinite loop
+    return std::atoi( str.c_str() );
+#else
     return ::atoi( str.c_str() );
+#endif
 }
 
 // Defined the shared options class here
@@ -176,8 +187,10 @@ fgOPTIONS::fgOPTIONS() :
        // $FG_ROOT is not set.  This can still be overridden from the
        // command line or a config file.
 
-#if defined(WIN32)
+#if defined( WIN32 )
        fg_root = "\\FlightGear";
+#elif defined( MACOS )
+       fg_root = ":";
 #else
        fg_root = "/usr/local/lib/FlightGear";
 #endif
index 2830858596cfc2d774a40c8ddd4ebdf839bf07de..ea3db088c6c98036a7274cc796fbee2996914ac1 100644 (file)
@@ -38,6 +38,7 @@
 #include <Debug/logstream.hxx>
 #include <Main/options.hxx>
 #include <Math/fg_random.h>
+#include <Misc/fgpath.hxx>
 #include <Objects/texload.h>
 
 #include "splash.hxx"
@@ -50,7 +51,6 @@ static GLubyte *splash_texbuf;
 
 // Initialize the splash screen
 void fgSplashInit ( void ) {
-    string tpath, fg_tpath;
     int width, height;
 
     FG_LOG( FG_GENERAL, FG_INFO, "Initializing splash screen" );
@@ -73,20 +73,23 @@ void fgSplashInit ( void ) {
     int num = (int)(fg_random() * 4.0 + 1.0);
     char num_str[256];
     sprintf(num_str, "%d", num);
-    tpath = current_options.get_fg_root() + "/Textures/Splash";
-    tpath += num_str;
-    tpath += ".rgb";
+
+    FGPath tpath( current_options.get_fg_root() );
+    tpath.append( "Textures/Splash" );
+    tpath.concat( num_str );
+    tpath.concat( ".rgb" );
 
     if ( (splash_texbuf = 
          read_rgb_texture(tpath.c_str(), &width, &height)) == NULL )
     {
        // Try compressed
-       fg_tpath = tpath + ".gz";
+       FGPath fg_tpath = tpath;
+       fg_tpath.concat( ".gz" );
        if ( (splash_texbuf = 
              read_rgb_texture(fg_tpath.c_str(), &width, &height)) == NULL )
        {
            FG_LOG( FG_GENERAL, FG_ALERT, 
-                   "Error in loading splash screen texture " << tpath );
+                   "Error in loading splash screen texture " << tpath.str() );
            exit(-1);
        } 
     } 
index c0ac2969ca299c64c4b081c0441786671c8761e7..e008f63ffdd5494d096713a6a7fc846876d61744 100644 (file)
@@ -37,6 +37,7 @@
 // #include <Bucket/bucketutils.hxx>
 #include <Main/options.hxx>
 #include <Main/views.hxx>
+#include <Misc/fgpath.hxx>
 #include <Objects/obj.hxx>
 
 #include "tile.hxx"
@@ -93,19 +94,21 @@ void
 fgTILECACHE::fill_in( int index, FGBucket& p )
 {
     // Load the appropriate data file and build tile fragment list
-    string tile_path = current_options.get_fg_root() +
-       "/Scenery/" + p.gen_base_path() + "/" + p.gen_index_str();
+    FGPath tile_path( current_options.get_fg_root() );
+    tile_path.append( "Scenery" );
+    tile_path.append( p.gen_base_path() );
+    tile_path.append( p.gen_index_str() );
 
     tile_cache[index].used = true;
     tile_cache[index].tile_bucket = p;
-    fgObjLoad( tile_path, &tile_cache[index] );
+    fgObjLoad( tile_path.str(), &tile_cache[index] );
 //     tile_cache[ index ].ObjLoad( tile_path, p );
 
     // cout << " ncount before = " << tile_cache[index].ncount << "\n";
     // cout << " fragments before = " << tile_cache[index].fragment_list.size()
     //      << "\n";
 
-    string apt_path = tile_path + ".apt";
+    string apt_path = tile_path.str() + ".apt";
     fgAptGenerate( apt_path, &tile_cache[index] );
 
     // cout << " ncount after = " << tile_cache[index].ncount << "\n";
index 92c3916c97bcf3014ce6821cfb620187b0459f7d..401fd2a3d4fa113b827e39c56b1a0380abac9369 100644 (file)
@@ -57,6 +57,7 @@ FG_USING_STD(string);
 #include <Math/interpolater.hxx>
 #include <Math/mat3.h>
 #include <Math/polar3d.hxx>
+#include <Misc/fgpath.hxx>
 
 #include "fg_time.hxx"
 #include "light.hxx"
@@ -77,19 +78,22 @@ void fgLIGHT::Init( void ) {
            "Initializing Lighting interpolation tables." );
 
     // build the path name to the ambient lookup table
-    string path = current_options.get_fg_root();
-    string ambient = path + "/Lighting/ambient";
-    string diffuse = path + "/Lighting/diffuse";
-    string sky     = path + "/Lighting/sky";
+    FGPath path( current_options.get_fg_root() );
+    FGPath ambient = path;
+    ambient.append( "Lighting/ambient" );
+    FGPath diffuse = path;
+    diffuse.append( "Lighting/diffuse" );
+    FGPath sky = path;
+    sky.append( "Lighting/sky" );
 
     // initialize ambient table
-    ambient_tbl = new fgINTERPTABLE( ambient );
+    ambient_tbl = new fgINTERPTABLE( ambient.str() );
 
     // initialize diffuse table
-    diffuse_tbl = new fgINTERPTABLE( diffuse );
+    diffuse_tbl = new fgINTERPTABLE( diffuse.str() );
     
     // initialize sky table
-    sky_tbl = new fgINTERPTABLE( sky );
+    sky_tbl = new fgINTERPTABLE( sky.str() );
 }
 
 
index 7d821aefe64e5fb8b95d2418142cac924da7288c..bbd0738618a2132fa8a87d9fc812c0f2ce98db3d 100644 (file)
@@ -136,6 +136,11 @@ inline void FGTimeStamp::stamp() {
     ftime(&current);
     seconds = current.time;
     usec = current.millitm * 1000;
+#elif defined( __MWERKS__ )
+    // -dw- uses system clock to get time stamp... don't know if this works
+    long ticks = clock();
+    seconds = ticks / CLOCKS_PER_SEC;
+    usec = seconds * 100000;
 #else
 # error Port me
 #endif