]> git.mxchange.org Git - flightgear.git/commitdiff
Code clean ups relating to FGOptions ... and moved it into globals-> space.
authorcurt <curt>
Thu, 19 Oct 2000 21:24:43 +0000 (21:24 +0000)
committercurt <curt>
Thu, 19 Oct 2000 21:24:43 +0000 (21:24 +0000)
34 files changed:
src/Autopilot/auto_gui.cxx
src/Autopilot/newauto.cxx
src/Cockpit/cockpit.cxx
src/Cockpit/hud.cxx
src/Cockpit/hud_ladr.cxx
src/Cockpit/panel.cxx
src/Cockpit/panel_io.cxx
src/Cockpit/steam.cxx
src/Controls/controls.hxx
src/FDM/Balloon.cxx
src/FDM/External.cxx
src/FDM/JSBSim.cxx
src/FDM/LaRCsim.cxx
src/FDM/MagicCarpet.cxx
src/GUI/gui.cxx
src/Main/bfi.cxx
src/Main/fg_init.cxx
src/Main/fg_init.hxx
src/Main/fg_io.cxx
src/Main/globals.hxx
src/Main/keyboard.cxx
src/Main/main.cxx
src/Main/options.cxx
src/Main/options.hxx
src/Main/splash.cxx
src/Main/viewer.cxx
src/Main/viewer.hxx
src/NetworkOLK/network.cxx
src/Objects/matlib.cxx
src/Objects/obj.cxx
src/Scenery/tilecache.cxx
src/Scenery/tilemgr.cxx
src/Time/light.cxx
src/Time/tmp.cxx

index 32a4733d85ca12553918f7bc2cac927b00f6f720..5987610464608ee24681b194eec99412b7f5846a 100644 (file)
@@ -293,7 +293,7 @@ void NewAltitudeInit(void)
 
     float alt = cur_fdm_state->get_Altitude();
 
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_METERS) {
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_METERS) {
        alt *= FEET_TO_METER;
     }
 
@@ -595,7 +595,7 @@ void TgtAptDialog_OK (puObject *)
        TgtAptId = tmp.substr( 0, pos );
        string alt_str = tmp.substr( pos + 1 );
        alt = atof( alt_str.c_str() );
-       if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+       if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
            alt *= FEET_TO_METER;
        }
     } else {
@@ -636,16 +636,16 @@ void TgtAptDialog_OK (puObject *)
 
 void TgtAptDialog_Reset(puObject *)
 {
-    //  strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
-    sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
+    //  strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
+    sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
     TgtAptDialogInput->setValue ( NewTgtAirportId );
     TgtAptDialogInput->setCursor( 0 ) ;
 }
 
 void AddWayPoint(puObject *cb)
 {
-    //  strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
-    sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
+    //  strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
+    sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
     TgtAptDialogInput->setValue( NewTgtAirportId );
     
     FG_PUSH_PUI_DIALOG( TgtAptDialog );
@@ -676,8 +676,8 @@ void ClearRoute(puObject *cb)
 void NewTgtAirportInit(void)
 {
     FG_LOG( FG_AUTOPILOT, FG_INFO, " enter NewTgtAirportInit()" );
-    // fgAPset_tgt_airport_id( current_options.get_airport_id() );     
-    sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
+    // fgAPset_tgt_airport_id( globals->get_options()->get_airport_id() );     
+    sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
     FG_LOG( FG_AUTOPILOT, FG_INFO, " NewTgtAirportId " << NewTgtAirportId );
     // printf(" NewTgtAirportId %s\n", NewTgtAirportId);
     int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
index 33a7421df68c208cfd2b149e9cdfe9f2d437e0df..3902bfc16a491da3ad4bec3cc8712b7bb49e5bd3 100644 (file)
@@ -100,7 +100,7 @@ static inline double get_speed( void ) {
 static inline double get_ground_speed() {
     // starts in ft/s so we convert to kts
     double ft_s = cur_fdm_state->get_V_ground_speed() 
-       * current_options.get_speed_up();;
+       * globals->get_options()->get_speed_up();;
     double kts = ft_s * FEET_TO_METER * 3600 * METER_TO_NM;
 
     return kts;
@@ -268,7 +268,7 @@ void FGAutopilot::reset() {
        
     update_old_control_values();
 
-    sprintf( NewTgtAirportId, "%s", current_options.get_airport_id().c_str() );
+    sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
        
     // TargetLatitude = FGBFI::getLatitude();
     // TargetLongitude = FGBFI::getLongitude();
@@ -744,7 +744,7 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) {
        // lock at current altitude
        TargetAltitude = FGBFI::getAltitude() * FEET_TO_METER;
 
-       if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+       if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
            MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
        } else {
            MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET );
@@ -755,7 +755,7 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) {
     } else if ( altitude_mode == FG_ALTITUDE_TERRAIN ) {
        TargetAGL = FGBFI::getAGL() * FEET_TO_METER;
 
-       if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+       if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
            MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET );
        } else {
            MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET );
@@ -821,7 +821,7 @@ void FGAutopilot::AltitudeSet( double new_altitude ) {
 
     // cout << "new altitude = " << new_altitude << endl;
 
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
        target_alt = new_altitude * FEET_TO_METER;
     }
 
@@ -834,7 +834,7 @@ void FGAutopilot::AltitudeSet( double new_altitude ) {
 
     // cout << "TargetAltitude = " << TargetAltitude << endl;
 
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
        target_alt *= METER_TO_FEET;
     }
     // ApAltitudeDialogInput->setValue((float)target_alt);
@@ -848,7 +848,7 @@ void FGAutopilot::AltitudeAdjust( double inc )
 {
     double target_alt, target_agl;
 
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
        target_alt = TargetAltitude * METER_TO_FEET;
        target_agl = TargetAGL * METER_TO_FEET;
     } else {
@@ -872,7 +872,7 @@ void FGAutopilot::AltitudeAdjust( double inc )
        target_agl = ( int ) ( target_agl / inc ) * inc + inc;
     }
 
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
        target_alt *= FEET_TO_METER;
        target_agl *= FEET_TO_METER;
     }
@@ -880,9 +880,9 @@ void FGAutopilot::AltitudeAdjust( double inc )
     TargetAltitude = target_alt;
     TargetAGL = target_agl;
        
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET )
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET )
        target_alt *= METER_TO_FEET;
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET )
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET )
        target_agl *= METER_TO_FEET;
 
     if ( altitude_mode == FG_ALTITUDE_LOCK ) {
index 3a88b6a5dc7d02e227bb620a57172bc89a336b33..5cdaee5b087d1b018866b9c70e6389ff4b2fd391 100644 (file)
@@ -156,7 +156,7 @@ float get_speed( void )
 {
     // Make an explicit function call.
     float speed = current_aircraft.fdm_state->get_V_calibrated_kts()
-       * current_options.get_speed_up();
+       * globals->get_options()->get_speed_up();
     return( speed );
 }
 
@@ -200,7 +200,7 @@ float get_altitude( void )
     //                         f->get_Latitude()  * RAD_TO_ARCSEC);
     float altitude;
 
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
         altitude = current_aircraft.fdm_state->get_Altitude();
     } else {
         altitude = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER);
@@ -212,7 +212,7 @@ float get_agl( void )
 {
     float agl;
 
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
         agl = (current_aircraft.fdm_state->get_Altitude()
                - scenery.cur_elev * METER_TO_FEET);
     } else {
@@ -236,7 +236,7 @@ float get_frame_rate( void )
 
 float get_fov( void )
 {
-    float fov = current_options.get_fov(); 
+    float fov = globals->get_options()->get_fov(); 
     return (fov);
 }
 
@@ -264,7 +264,7 @@ float get_vfc_tris_culled   ( void )
 float get_climb_rate( void )
 {
     float climb_rate;
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
         climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
     } else {
         climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * FEET_TO_METER * 60.0;
@@ -705,7 +705,7 @@ void fgCockpitUpdate( void ) {
        float width  = iwidth;
        float height = iheight;
 
-    if ( current_options.get_hud_status() ) {
+    if ( globals->get_options()->get_hud_status() ) {
         // This will check the global hud linked list pointer.
         // If these is anything to draw it will.
         fgUpdateHUD();
index 79dc7593af9cf0c4e39bbe476c32cd0726e42f77..9f5449ed6c4465203b626dc18360db8ad67e8051 100644 (file)
@@ -225,8 +225,8 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
     int gap = 10;
 #endif
 
-//  int font_size = current_options.get_xsize() / 60;
-  int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
+//  int font_size = globals->get_options()->get_xsize() / 60;
+  int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
   
   HUD_style = 1;
 
@@ -1002,7 +1002,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
   HUD_deque.insert( HUD_deque.begin(), HIptr);
 
 //      case 20:
-      switch( current_options.get_tris_or_culled() ) {
+      switch( globals->get_options()->get_tris_or_culled() ) {
       case 0:
           HIptr = (instr_item *) new instr_label( 10,
                               25,
@@ -1090,8 +1090,8 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
     int compass_w = 200;
 //  int gap = 10;
 
-//     int font_size = current_options.get_xsize() / 60;
-    int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
+//     int font_size = globals->get_options()->get_xsize() / 60;
+    int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
 
     HUD_style = 2;
 
@@ -1266,7 +1266,7 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
                          TRUE );
     HUD_deque.push_front( p );
 
-    if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+    if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
     strcpy(units, " ft");
     } else {
     strcpy(units, " m");
@@ -1364,14 +1364,14 @@ int global_day_night_switch = DAY;
 
 void HUD_masterswitch( bool incr )
 {
-    if ( current_options.get_hud_status() ) {
+    if ( globals->get_options()->get_hud_status() ) {
        if ( global_day_night_switch == DAY ) {
            global_day_night_switch = NIGHT;
        } else {
-           current_options.set_hud_status( false );
+           globals->get_options()->set_hud_status( false );
        }
     } else {
-       current_options.set_hud_status( true );
+       globals->get_options()->set_hud_status( true );
        global_day_night_switch = DAY;
     }  
 }
@@ -1381,7 +1381,7 @@ void HUD_brightkey( bool incr_bright )
     instr_item *pHUDInstr = HUD_deque[0];
     int brightness        = pHUDInstr->get_brightness();
 
-    if( current_options.get_hud_status() ) {
+    if( globals->get_options()->get_hud_status() ) {
        if( incr_bright ) {
            switch (brightness)
                {
@@ -1424,11 +1424,11 @@ void HUD_brightkey( bool incr_bright )
                    break;
 
                default:
-                   current_options.set_hud_status(0);
+                   globals->get_options()->set_hud_status(0);
                }
        }
     } else {
-       current_options.set_hud_status(true);
+       globals->get_options()->set_hud_status(true);
     }
 
     pHUDInstr->SetBrightness( brightness );
@@ -1456,7 +1456,7 @@ static void alpha_adj( puObject *hs ) {
 }
 
 void fgHUDalphaAdjust( puObject * ) {
-       current_options.set_anti_alias_hud(1);
+       globals->get_options()->set_anti_alias_hud(1);
        FG_PUSH_PUI_DIALOG( HUDalphaDialog );
 }
 
@@ -1467,7 +1467,7 @@ static void goAwayHUDalphaAdjust (puObject *)
 
 static void cancelHUDalphaAdjust (puObject *)
 {
-       current_options.set_anti_alias_hud(0);
+       globals->get_options()->set_anti_alias_hud(0);
        FG_POP_PUI_DIALOG( HUDalphaDialog );
 }
 
@@ -1555,7 +1555,7 @@ void fgHUDReshape(void) {
        if ( HUDtext )
                delete HUDtext;
 
-       HUD_TextSize = current_options.get_xsize() / 60;
+       HUD_TextSize = globals->get_options()->get_xsize() / 60;
         HUD_TextSize = 10;
        HUDtext = new fntRenderer();
        HUDtext -> setFont      ( guiFntHandle ) ;
@@ -1565,7 +1565,7 @@ void fgHUDReshape(void) {
 
 
 static void set_hud_color(float r, float g, float b) {
-       current_options.get_anti_alias_hud() ?
+       globals->get_options()->get_anti_alias_hud() ?
                        glColor4f(r,g,b,hud_trans_alpha) :
                        glColor3f(r,g,b);
 }
@@ -1608,7 +1608,7 @@ void fgUpdateHUD( void ) {
   glDisable(GL_DEPTH_TEST);
   glDisable(GL_LIGHTING);
 
-  if( current_options.get_anti_alias_hud() ) {
+  if( globals->get_options()->get_anti_alias_hud() ) {
          glEnable(GL_LINE_SMOOTH);
 //       glEnable(GL_BLEND);
          glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
@@ -1744,7 +1744,7 @@ void fgUpdateHUD( void ) {
 //  HUD_StippleLineList.draw();
 //  glDisable(GL_LINE_STIPPLE);
 
-  if( current_options.get_anti_alias_hud() ) {
+  if( globals->get_options()->get_anti_alias_hud() ) {
 //       glDisable(GL_BLEND);
          glDisable(GL_LINE_SMOOTH);
          glLineWidth(1.0);
index 300c091e407742776e8761849cc0a7990d6381c7..61faf63fc5b282bb0e392aa31174f7064c4e0ba3 100644 (file)
@@ -530,7 +530,7 @@ void HudLadder :: draw( void )
     glPushMatrix();
     glTranslatef( centroid.x, centroid.y, 0);
        // Alex's panel patch
-//     glScalef( current_options.get_fov()/55.0, 1.0, 1.0 );
+//     glScalef( globals->get_options()->get_fov()/55.0, 1.0, 1.0 );
     glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
 
     // Draw the target spot.
index cc4f10436679107f2f1319b778a4f728ac66c848..74d897d40669e4a8dced475c125fed2c158c62f1 100644 (file)
@@ -44,8 +44,8 @@
 bool
 fgPanelVisible ()
 {
-  return ((current_options.get_panel_status()) &&
-         (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_PILOT) &&
+  return ((globals->get_options()->get_panel_status()) &&
+         (globals->get_options()->get_view_mode() == FGOptions::FG_VIEW_PILOT) &&
          (globals->get_current_view()->get_view_offset() == 0.0));
 }
 
@@ -63,7 +63,7 @@ FGTextureManager::createTexture (const string &relativePath)
   ssgTexture * texture = _textureMap[relativePath];
   if (texture == 0) {
     cerr << "Texture " << relativePath << " does not yet exist" << endl;
-    FGPath tpath(current_options.get_fg_root());
+    FGPath tpath(globals->get_options()->get_fg_root());
     tpath.append(relativePath);
     texture = new ssgTexture((char *)tpath.c_str(), false, false);
     _textureMap[relativePath] = texture;
index da80239e9cb997696cedb374de61513806fa1828..38e1036138ad4db6cfcf7599aab26e0713fd18ec 100644 (file)
@@ -35,7 +35,7 @@
 #include <fstream>
 #include <string>
 
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
 
 #include "panel.hxx"
 #include "steam.hxx"
@@ -748,7 +748,7 @@ fgReadPanel (istream &input)
     SGPropertyList props2;
     SGPropertyNode node = instrument_group.getChild(i);
 
-    FGPath path(current_options.get_fg_root());
+    FGPath path( globals->get_options()->get_fg_root() );
     path.append(node.getStringValue("path"));
 
     FG_LOG(FG_INPUT, FG_INFO, "Reading instrument "
@@ -798,7 +798,7 @@ FGPanel *
 fgReadPanel (const string &relative_path)
 {
   FGPanel * panel = 0;
-  FGPath path(current_options.get_fg_root());
+  FGPath path(globals->get_options()->get_fg_root());
   path.append(relative_path);
   ifstream input(path.c_str());
   if (!input.good()) {
index 31551c35425c953457d6006a430c914b12a2a855..33dca63f2968a3f708a4c9c65aeaf2124d291a04 100644 (file)
@@ -166,7 +166,8 @@ void FGSteam::set_lowpass ( double *outthe, double inthe, double tc )
 
 void FGSteam::_CatchUp()
 { if ( _UpdatesPending != 0 )
-  {    double dt = _UpdatesPending * 1.0 / current_options.get_model_hz();
+  {    double dt = _UpdatesPending * 1.0 / 
+           globals->get_options()->get_model_hz();
         double AccN, AccE, AccU;
        int i /*,j*/;
        double d, the_ENGINE_rpm;
index 7c0ba350f771130810e675d21bcc96b557c09ec5..e12c4362e971b9962bf3965810330f39c1132dad 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef _CONTROLS_HXX
 #define _CONTROLS_HXX
 
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
 
 #ifndef __cplusplus                                                          
 # error This library requires C++
@@ -94,8 +94,8 @@ public:
        CLAMP( &aileron, -1.0, 1.0 );
                        
        // check for autocoordination
-       if ( current_options.get_auto_coordination() == 
-            fgOPTIONS::FG_AUTO_COORD_ENABLED ) 
+       if ( globals->get_options()->get_auto_coordination() == 
+            FGOptions::FG_AUTO_COORD_ENABLED ) 
        {
            set_rudder( aileron / 2.0 );
        }
@@ -105,8 +105,8 @@ public:
        CLAMP( &aileron, -1.0, 1.0 );
                        
        // check for autocoordination
-       if ( current_options.get_auto_coordination() == 
-            fgOPTIONS::FG_AUTO_COORD_ENABLED ) 
+       if ( globals->get_options()->get_auto_coordination() == 
+            FGOptions::FG_AUTO_COORD_ENABLED ) 
        {
            set_rudder( aileron / 2.0 );
        }
index 211b7c6acf3747d06595175793943bf0062a988f..8bd81ecf183b7e3b25a8ac79cb3a7bf39fd9dfe9 100644 (file)
@@ -89,9 +89,9 @@ bool FGBalloonSim::init( double dt ) {
 
     //set velocities
     sgSetVec3( temp,
-       current_options.get_uBody(), 
-       current_options.get_vBody(), 
-       current_options.get_wBody() );
+       globals->get_options()->get_uBody(), 
+       globals->get_options()->get_vBody(), 
+       globals->get_options()->get_wBody() );
     current_balloon.setVelocity( temp );
 
     FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing BalloonSim" );
index f5d3b8f4a10ac0f682f4302d8afb8a1f3bf5ed25..348d587d982eb9dfc56dece1796a9d21e50cdb57 100644 (file)
@@ -42,7 +42,8 @@ bool FGExternal::init( double dt ) {
 bool FGExternal::update( int multiloop ) {
     // cout << "FGExternal::update()" << endl;
 
-    // double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
+    // double time_step = (1.0 / globals->get_options()->get_model_hz())
+    //                     * multiloop;
 
 
     return true;
index 7037273e0b8a4bfad53b7596279bdd8e615d06b2..b842acda15cf490ab1509c9c0fc3f07cf27d6a4e 100644 (file)
@@ -67,23 +67,25 @@ bool FGJSBsim::init( double dt ) {
   FG_LOG( FG_FLIGHT, FG_INFO, "Starting and initializing JSBsim" );
   FG_LOG( FG_FLIGHT, FG_INFO, "  created FDMExec" );
 
-  FGPath aircraft_path( current_options.get_fg_root() );
+  FGPath aircraft_path( globals->get_options()->get_fg_root() );
   aircraft_path.append( "Aircraft" );
 
-  FGPath engine_path( current_options.get_fg_root() );
+  FGPath engine_path( globals->get_options()->get_fg_root() );
   engine_path.append( "Engine" );
 
   //FDMExec.GetState()->Setdt( dt );
 
   result = FDMExec.LoadModel( aircraft_path.str(),
                                        engine_path.str(),
-                                       current_options.get_aircraft() );
+                                       globals->get_options()->get_aircraft() );
   FDMExec.GetState()->Setdt( dt );
   
   if (result) {
-    FG_LOG( FG_FLIGHT, FG_INFO, "  loaded aircraft " << current_options.get_aircraft() );
+    FG_LOG( FG_FLIGHT, FG_INFO, "  loaded aircraft "
+           << globals->get_options()->get_aircraft() );
   } else {
-    FG_LOG( FG_FLIGHT, FG_INFO, "  aircraft " << current_options.get_aircraft()
+    FG_LOG( FG_FLIGHT, FG_INFO, "  aircraft "
+           << globals->get_options()->get_aircraft()
            << " does not exist" );
     return false;
   }
@@ -105,31 +107,35 @@ bool FGJSBsim::init( double dt ) {
   
   FGInitialCondition *fgic = new FGInitialCondition(&FDMExec);
   fgic->SetAltitudeFtIC(get_Altitude());
-  if((current_options.get_mach() < 0) && (current_options.get_vc() < 0 )) {
-    fgic->SetUBodyFpsIC(current_options.get_uBody());
-    fgic->SetVBodyFpsIC(current_options.get_vBody());
-    fgic->SetWBodyFpsIC(current_options.get_wBody());
-    FG_LOG(FG_FLIGHT,FG_INFO, "  u,v,w= " << current_options.get_uBody()
-           << ", " << current_options.get_vBody()
-           << ", " << current_options.get_wBody());
-  } else if (current_options.get_vc() < 0) {
-    fgic->SetMachIC(current_options.get_mach());
-    FG_LOG(FG_FLIGHT,FG_INFO, "  mach: " << current_options.get_mach() );
+  if ( (globals->get_options()->get_mach() < 0) && 
+      (globals->get_options()->get_vc() < 0 ) )
+  {
+    fgic->SetUBodyFpsIC(globals->get_options()->get_uBody());
+    fgic->SetVBodyFpsIC(globals->get_options()->get_vBody());
+    fgic->SetWBodyFpsIC(globals->get_options()->get_wBody());
+    FG_LOG(FG_FLIGHT,FG_INFO, "  u,v,w= " << globals->get_options()->get_uBody()
+           << ", " << globals->get_options()->get_vBody()
+           << ", " << globals->get_options()->get_wBody());
+  } else if (globals->get_options()->get_vc() < 0) {
+    fgic->SetMachIC(globals->get_options()->get_mach());
+    FG_LOG( FG_FLIGHT,FG_INFO, "  mach: "
+           << globals->get_options()->get_mach() );
   } else {
-    fgic->SetVcalibratedKtsIC(current_options.get_vc());
-    FG_LOG(FG_FLIGHT,FG_INFO, "  vc: " << current_options.get_vc() );
+    fgic->SetVcalibratedKtsIC(globals->get_options()->get_vc());
+    FG_LOG(FG_FLIGHT,FG_INFO, "  vc: " << globals->get_options()->get_vc() );
     //this should cover the case in which no speed switches are used
-    //current_options.get_vc() will return zero by default
+    //globals->get_options()->get_vc() will return zero by default
   }
 
-  //fgic->SetFlightPathAngleDegIC(current_options.get_Gamma());
+  //fgic->SetFlightPathAngleDegIC(globals->get_options()->get_Gamma());
   fgic->SetRollAngleRadIC(get_Phi());
   fgic->SetPitchAngleRadIC(get_Theta());
   fgic->SetHeadingRadIC(get_Psi());
   fgic->SetLatitudeRadIC(get_Lat_geocentric());
   fgic->SetLongitudeRadIC(get_Longitude());
 
-  //FG_LOG( FG_FLIGHT, FG_INFO, "  gamma: " <<  current_options.get_Gamma());
+  // FG_LOG( FG_FLIGHT, FG_INFO, "  gamma: "
+  //         << globals->get_options()->get_Gamma());
   FG_LOG( FG_FLIGHT, FG_INFO, "  phi: " <<  get_Phi());
   //FG_LOG( FG_FLIGHT, FG_INFO, "  theta: " <<  get_Theta() );
   FG_LOG( FG_FLIGHT, FG_INFO, "  psi: " <<  get_Psi() );
@@ -143,10 +149,10 @@ bool FGJSBsim::init( double dt ) {
           <<  get_Altitude() + get_Sea_level_radius()
                 - scenery.cur_radius*METER_TO_FEET );
   
-  FG_LOG( FG_FLIGHT, FG_INFO, "      current_options.get_altitude(): " 
-          <<  current_options.get_altitude() );
+  FG_LOG( FG_FLIGHT, FG_INFO, "      globals->get_options()->get_altitude(): " 
+          <<  globals->get_options()->get_altitude() );
   //must check > 0, != 0 will give bad result if --notrim set
-  if(current_options.get_trim_mode() > 0) {
+  if(globals->get_options()->get_trim_mode() > 0) {
     if(fgic->GetVcalibratedKtsIC() > 50) {
       FDMExec.RunIC(fgic);
       FG_LOG( FG_FLIGHT, FG_INFO, "  Starting trim..." );
@@ -158,7 +164,8 @@ bool FGJSBsim::init( double dt ) {
 
 
       controls.set_elevator_trim(FDMExec.GetFCS()->GetPitchTrimCmd());
-      controls.set_throttle(FGControls::ALL_ENGINES,FDMExec.GetFCS()->GetThrottleCmd(0)/100);
+      controls.set_throttle( FGControls::ALL_ENGINES,
+                            FDMExec.GetFCS()->GetThrottleCmd(0)/100 );
       trimmed=true;
       trim_elev=FDMExec.GetFCS()->GetPitchTrimCmd();
       trim_throttle=FDMExec.GetFCS()->GetThrottleCmd(0)/100;
@@ -192,7 +199,7 @@ bool FGJSBsim::init( double dt ) {
 
 bool FGJSBsim::update( int multiloop ) {
   double save_alt = 0.0;
-  double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
+  double time_step = (1.0 / globals->get_options()->get_model_hz()) * multiloop;
   double start_elev = get_Altitude();
  
   
@@ -261,7 +268,7 @@ bool FGJSBsim::copy_to_JSBsim() {
   FDMExec.GetFCS()->SetCBrake( controls.get_brake( 2 ) );
 
   // Inform JSBsim of the local terrain altitude; uncommented 5/3/00
-  //  FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work
+  // FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work
   FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET);
   FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius());
 
@@ -343,7 +350,8 @@ bool FGJSBsim::copy_from_JSBsim() {
                    FDMExec.GetRotation()->GetEulerRates()(1),
                    FDMExec.GetRotation()->GetEulerRates()(3));
 
-  // ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
+  // ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot,
+  //                                   Radius_dot );
 
   set_Mach_number( FDMExec.GetTranslation()->GetMach());
 
index f1e7422364d25fc33bc015370d194f0672010f08..86c17b6c850e11e50a35f8133a286c416f4657de 100644 (file)
@@ -39,7 +39,7 @@
 // each subsequent iteration through the EOM
 bool FGLaRCsim::init( double dt ) {
 
-    if ( current_options.get_aircraft() == "c172" ) {
+    if ( globals->get_options()->get_aircraft() == "c172" ) {
        // Initialize our little engine that hopefully might
        eng.init(dt);
        // dcl - in passing dt to init rather than update I am assuming
@@ -63,7 +63,7 @@ bool FGLaRCsim::init( double dt ) {
     copy_to_LaRCsim();
 
     // actual LaRCsim top level init
-    ls_toplevel_init( dt, (char *)current_options.get_aircraft().c_str() );
+    ls_toplevel_init( dt, (char *)globals->get_options()->get_aircraft().c_str() );
 
     FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << 
            get_Latitude() );
@@ -87,7 +87,7 @@ bool FGLaRCsim::init( double dt ) {
 bool FGLaRCsim::update( int multiloop ) {
     // cout << "FGLaRCsim::update()" << endl;
 
-    if ( current_options.get_aircraft() == "c172" ) {
+    if ( globals->get_options()->get_aircraft() == "c172" ) {
        // set control inputs
        eng.set_IAS( V_calibrated_kts );
        eng.set_Throttle_Lever_Pos( controls.get_throttle( 0 ) * 100.0 );
@@ -129,7 +129,8 @@ bool FGLaRCsim::update( int multiloop ) {
     }
 
     double save_alt = 0.0;
-    double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
+    double time_step = (1.0 / globals->get_options()->get_model_hz())
+       * multiloop;
     double start_elev = get_Altitude();
 
     // lets try to avoid really screwing up the LaRCsim model
@@ -139,13 +140,15 @@ bool FGLaRCsim::update( int multiloop ) {
     }
 
     // copy control positions into the LaRCsim structure
-    Lat_control = controls.get_aileron() / current_options.get_speed_up();
+    Lat_control = controls.get_aileron() /
+       globals->get_options()->get_speed_up();
     Long_control = controls.get_elevator();
     Long_trim = controls.get_elevator_trim();
-    Rudder_pedal = controls.get_rudder() / current_options.get_speed_up();
+    Rudder_pedal = controls.get_rudder() /
+       globals->get_options()->get_speed_up();
     Flap_handle = 30.0 * controls.get_flaps();
 
-    if ( current_options.get_aircraft() == "c172" ) {
+    if ( globals->get_options()->get_aircraft() == "c172" ) {
        Use_External_Engine = 1;
     } else {
        Use_External_Engine = 0;
index 12a018e3dbc9ef59b9f83b9e0a0ae2219b379ddc..034b79259cdefdc4cddd1b66d614a7c8e3e1b6c6 100644 (file)
@@ -26,7 +26,7 @@
 #include <simgear/math/polar3d.hxx>
 
 #include <Controls/controls.hxx>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
 
 #include "MagicCarpet.hxx"
 
@@ -45,7 +45,8 @@ bool FGMagicCarpet::init( double dt ) {
 bool FGMagicCarpet::update( int multiloop ) {
     // cout << "FGLaRCsim::update()" << endl;
 
-    double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
+    double time_step = (1.0 / globals->get_options()->get_model_hz()) *
+       multiloop;
 
     // speed and distance traveled
     double speed = controls.get_throttle( 0 ) * 2000; // meters/sec
index 64bd707d88220a7b9827e515d94b948cf834e41c..af3acd4a16e175b402cb2d338d2ea46ec3e35d01 100644 (file)
@@ -389,7 +389,7 @@ void guiMotionFunc ( int x, int y )
             case MOUSE_YOKE:
                 if( !mouse_joystick_control ) {
                     mouse_joystick_control = 1;
-                    current_options.set_control_mode( fgOPTIONS::FG_MOUSE );
+                    globals->get_options()->set_control_mode( FGOptions::FG_MOUSE );
                 } else {
                     if ( left_button() ) {
                         offset = (_mX - x) * brake_sensitivity;
@@ -596,7 +596,7 @@ void guiMouseFunc(int button, int updown, int x, int y)
                     
                 case MOUSE_YOKE:
                     mouse_mode = MOUSE_VIEW;
-                    current_options.set_control_mode( fgOPTIONS::FG_JOYSTICK );
+                    globals->get_options()->set_control_mode( FGOptions::FG_JOYSTICK );
                     x = globals->get_current_view()->get_winWidth()/2;
                     y = globals->get_current_view()->get_winHeight()/2;
                     _mVtoggle = 0;
@@ -740,7 +740,7 @@ static void toggleClouds(puObject *cb)
 // This is the accessor function
 void guiTogglePanel(puObject *cb)
 {
-    current_options.toggle_panel();
+    globals->get_options()->toggle_panel();
 }
     
 //void MenuHideMenuCb(puObject *cb)
@@ -756,7 +756,7 @@ void goodBye(puObject *)
     cout << "Program exiting normally at user request." << endl;
 
 #ifdef FG_NETWORK_OLK    
-    if ( current_options.get_network_olk() ) {
+    if ( globals->get_options()->get_network_olk() ) {
        if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
     }
 #endif
@@ -776,8 +776,8 @@ void goAwayCb (puObject *me)
 void mkDialogInit (void)
 {
     //  printf("mkDialogInit\n");
-    int x = (current_options.get_xsize()/2 - 400/2);
-    int y = (current_options.get_ysize()/2 - 100/2);
+    int x = (globals->get_options()->get_xsize()/2 - 400/2);
+    int y = (globals->get_options()->get_ysize()/2 - 100/2);
     dialogBox = new puDialogBox (x, y); // 150, 50
     {
         dialogFrame = new puFrame (0,0,400,100);
@@ -809,8 +809,8 @@ void ConfirmExitDialogInit(void)
     //  printf("ConfirmExitDialogInit\n");
     int len = 200 - puGetStringWidth( puGetDefaultLabelFont(), msg )/2;
 
-    int x = (current_options.get_xsize()/2 - 400/2);
-    int y = (current_options.get_ysize()/2 - 100/2);
+    int x = (globals->get_options()->get_xsize()/2 - 400/2);
+    int y = (globals->get_options()->get_ysize()/2 - 100/2);
        
     YNdialogBox = new puDialogBox (x, y); // 150, 50
     //  YNdialogBox = new puDialogBox (150, 50);
@@ -882,10 +882,10 @@ static GlBitmap *b1 = NULL;
 extern FGInterface cur_view_fdm;
 GLubyte *hiResScreenCapture( int multiplier )
 {
-       float oldfov = current_options.get_fov();
+       float oldfov = globals->get_options()->get_fov();
        float fov = oldfov / multiplier;
        FGViewer *v = globals->get_current_view();
-       current_options.set_fov(fov);
+       globals->get_options()->set_fov(fov);
        v->force_update_fov_math();
     fgInitVisuals();
     int cur_width = globals->get_current_view()->get_winWidth( );
@@ -908,7 +908,7 @@ GLubyte *hiResScreenCapture( int multiplier )
                }
        }
        globals->get_current_view()->UpdateViewParams(cur_view_fdm);
-       current_options.set_fov(oldfov);
+       globals->get_options()->set_fov(oldfov);
        v->force_update_fov_math();
        return b1->getBitmap();
 }
@@ -976,8 +976,8 @@ void fgDumpSnapShot () {
     fgRenderFrame();
 
     my_glDumpWindow( "fgfs-screen.ppm", 
-                    current_options.get_xsize(), 
-                    current_options.get_ysize() );
+                    globals->get_options()->get_xsize(), 
+                    globals->get_options()->get_ysize() );
     
     mkDialog ("Snap shot saved to fgfs-screen.ppm");
 
@@ -1017,7 +1017,7 @@ void AptDialog_Cancel(puObject *)
 
 void AptDialog_OK (puObject *)
 {
-    FGPath path( current_options.get_fg_root() );
+    FGPath path( globals->get_options()->get_fg_root() );
     path.append( "Airports" );
     path.append( "simple.mk4" );
     FGAirports airports( path.c_str() );
@@ -1044,8 +1044,8 @@ void AptDialog_OK (puObject *)
 
         if ( airports.search( AptId, &a ) )
         {
-            current_options.set_airport_id( AptId.c_str() );
-            current_options.set_altitude( -9999.0 );
+            globals->get_options()->set_airport_id( AptId.c_str() );
+            globals->get_options()->set_altitude( -9999.0 );
            // fgSetPosFromAirportID( AptId );
            fgSetPosFromAirportIDandHdg( AptId, 
                                         cur_fdm_state->get_Psi() * RAD_TO_DEG);
@@ -1063,16 +1063,16 @@ void AptDialog_OK (puObject *)
 
 void AptDialog_Reset(puObject *)
 {
-    //  strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
-    sprintf( NewAirportId, "%s", current_options.get_airport_id().c_str() );
+    //  strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
+    sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
     AptDialogInput->setValue ( NewAirportId );
     AptDialogInput->setCursor( 0 ) ;
 }
 
 void NewAirport(puObject *cb)
 {
-    //  strncpy( NewAirportId, current_options.get_airport_id().c_str(), 16 );
-    sprintf( NewAirportId, "%s", current_options.get_airport_id().c_str() );
+    //  strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
+    sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
 //     cout << "NewAirport " << NewAirportId << endl;
     AptDialogInput->setValue( NewAirportId );
 
@@ -1081,7 +1081,7 @@ void NewAirport(puObject *cb)
 
 static void NewAirportInit(void)
 {
-    sprintf( NewAirportId, "%s", current_options.get_airport_id().c_str() );
+    sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
     int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
                                       NewAirportLabel ) / 2;
 
@@ -1149,9 +1149,9 @@ void NetIdDialog_OK (puObject *)
     NetId = net_callsign;
     
     NetIdDialog_Cancel( NULL );
-    current_options.set_net_id( NetId.c_str() );
+    globals->get_options()->set_net_id( NetId.c_str() );
     strcpy( fgd_callsign, net_callsign);
-//    strcpy( fgd_callsign, current_options.get_net_id().c_str());
+//    strcpy( fgd_callsign, globals->get_options()->get_net_id().c_str());
 /* Entering a callsign indicates : user wants Net HUD Info */
     net_hud_display = 1;
 
@@ -1161,7 +1161,7 @@ void NetIdDialog_OK (puObject *)
 
 void NewCallSign(puObject *cb)
 {
-    sprintf( NewNetId, "%s", current_options.get_net_id().c_str() );
+    sprintf( NewNetId, "%s", globals->get_options()->get_net_id().c_str() );
 //    sprintf( NewNetId, "%s", fgd_callsign );
     NetIdDialogInput->setValue( NewNetId );
 
@@ -1170,7 +1170,7 @@ void NewCallSign(puObject *cb)
 
 static void NewNetIdInit(void)
 {
-    sprintf( NewNetId, "%s", current_options.get_net_id().c_str() );
+    sprintf( NewNetId, "%s", globals->get_options()->get_net_id().c_str() );
 //    sprintf( NewNetId, "%s", fgd_callsign );
     int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
                                       NewNetIdLabel ) / 2;
@@ -1323,7 +1323,7 @@ void net_fgd_scan(puObject *cb)
 
 static void NewNetFGDInit(void)
 {
-//    sprintf( NewNetId, "%s", current_options.get_net_id().c_str() );
+//    sprintf( NewNetId, "%s", globals->get_options()->get_net_id().c_str() );
 //    sprintf( NewNetId, "%s", fgd_callsign );
     int len = 170 - puGetStringWidth( puGetDefaultLabelFont(),
                                       NewNetFGDLabel ) / 2;
@@ -1518,7 +1518,7 @@ void guiInit()
     if ( envp != NULL ) {
         fntpath.set( envp );
     } else {
-        fntpath.set( current_options.get_fg_root() );
+        fntpath.set( globals->get_options()->get_fg_root() );
        fntpath.append( "Fonts" );
     }
 
@@ -1530,7 +1530,7 @@ void guiInit()
     puSetDefaultFonts( GuiFont, GuiFont ) ;
     guiFnt = puGetDefaultLabelFont();
   
-    if ( current_options.get_mouse_pointer() == 0 ) {
+    if ( globals->get_options()->get_mouse_pointer() == 0 ) {
         // no preference specified for mouse pointer, attempt to autodetect...
         // Determine if we need to render the cursor, or if the windowing
         // system will do it.  First test if we are rendering with glide.
@@ -1545,9 +1545,9 @@ void guiInit()
             }
         }
         mouse_active = ~mouse_active;
-    } else if ( current_options.get_mouse_pointer() == 1 ) {
+    } else if ( globals->get_options()->get_mouse_pointer() == 1 ) {
         // don't show pointer
-    } else if ( current_options.get_mouse_pointer() == 2 ) {
+    } else if ( globals->get_options()->get_mouse_pointer() == 2 ) {
         // force showing pointer
         puShowCursor();
         mouse_active = ~mouse_active;
@@ -1576,7 +1576,7 @@ void guiInit()
     mainMenuBar -> add_submenu ("Autopilot", autopilotSubmenu, autopilotSubmenuCb);
     // mainMenuBar -> add_submenu ("Options", optionsSubmenu, optionsSubmenuCb);
 #ifdef FG_NETWORK_OLK
-    if ( current_options.get_network_olk() ) {
+    if ( globals->get_options()->get_network_olk() ) {
        mainMenuBar -> add_submenu ("Network", networkSubmenu, networkSubmenuCb);
     }
 #endif
index 89c2b952d53a35b28aee1d0180d89a9deae78b2e..67f25792f83120bdd7ffcb6fd3d0dc7b65107938 100644 (file)
@@ -288,7 +288,7 @@ FGBFI::reinit ()
   double gpsLongitude = getGPSTargetLongitude();
 
   setTargetAirport("");
-  cout << "Target airport is " << current_options.get_airport_id() << endl;
+  cout << "Target airport is " << globals->get_options()->get_airport_id() << endl;
 
   fgReInitSubsystems();
 
@@ -338,7 +338,7 @@ FGBFI::reinit ()
 int
 FGBFI::getFlightModel ()
 {
-  return current_options.get_flight_model();
+  return globals->get_options()->get_flight_model();
 }
 
 
@@ -348,7 +348,7 @@ FGBFI::getFlightModel ()
 const string
 FGBFI::getAircraft ()
 {
-  return current_options.get_aircraft();
+  return globals->get_options()->get_aircraft();
 }
 
 
@@ -371,7 +371,7 @@ void
 FGBFI::setFlightModel (int model)
 {
   if (getFlightModel() != model) {
-    current_options.set_flight_model(model);
+    globals->get_options()->set_flight_model(model);
     needReinit();
   }
 }
@@ -384,7 +384,7 @@ void
 FGBFI::setAircraft (const string &aircraft)
 {
   if (getAircraft() != aircraft) {
-    current_options.set_aircraft(aircraft);
+    globals->get_options()->set_aircraft(aircraft);
     needReinit();
   }
 }
@@ -422,8 +422,8 @@ FGBFI::setTimeGMT (time_t time)
   if (getTimeGMT() != time) {
                                // FIXME: need to update lighting
                                // and solar system
-    current_options.set_time_offset(time);
-    current_options.set_time_offset_type(fgOPTIONS::FG_TIME_GMT_ABSOLUTE);
+    globals->get_options()->set_time_offset(time);
+    globals->get_options()->set_time_offset_type(FGOptions::FG_TIME_GMT_ABSOLUTE);
     globals->get_time_params()->update( cur_fdm_state->get_Longitude(),
                                        cur_fdm_state->get_Latitude(),
                                        globals->get_warp() );
@@ -454,7 +454,7 @@ FGBFI::getGMTString ()
 bool
 FGBFI::getHUDVisible ()
 {
-  return current_options.get_hud_status();
+  return globals->get_options()->get_hud_status();
 }
 
 
@@ -464,7 +464,7 @@ FGBFI::getHUDVisible ()
 void
 FGBFI::setHUDVisible (bool visible)
 {
-  current_options.set_hud_status(visible);
+  globals->get_options()->set_hud_status(visible);
 }
 
 
@@ -474,7 +474,7 @@ FGBFI::setHUDVisible (bool visible)
 bool
 FGBFI::getPanelVisible ()
 {
-  return current_options.get_panel_status();
+  return globals->get_options()->get_panel_status();
 }
 
 
@@ -484,8 +484,8 @@ FGBFI::getPanelVisible ()
 void
 FGBFI::setPanelVisible (bool visible)
 {
-  if (current_options.get_panel_status() != visible) {
-    current_options.toggle_panel();
+  if (globals->get_options()->get_panel_status() != visible) {
+    globals->get_options()->toggle_panel();
   }
 }
 
@@ -513,7 +513,7 @@ void
 FGBFI::setLatitude (double latitude)
 {
   if (getLatitude() != latitude) {
-    current_options.set_lat(latitude);
+    globals->get_options()->set_lat(latitude);
     current_aircraft.fdm_state->set_Latitude(latitude * DEG_TO_RAD);
     needReinit();
   }
@@ -537,7 +537,7 @@ void
 FGBFI::setLongitude (double longitude)
 {
   if (getLongitude() != longitude) {
-    current_options.set_lon(longitude);
+    globals->get_options()->set_lon(longitude);
     current_aircraft.fdm_state->set_Longitude(longitude * DEG_TO_RAD);
     needReinit();
   }
@@ -574,7 +574,7 @@ FGBFI::setAltitude (double altitude)
 {
   if (getAltitude() != altitude) {
     fgFDMForceAltitude(getFlightModel(), altitude);
-    current_options.set_altitude(altitude);
+    globals->get_options()->set_altitude(altitude);
     current_aircraft.fdm_state->set_Altitude(altitude);
   }
 }
@@ -613,7 +613,7 @@ void
 FGBFI::setHeading (double heading)
 {
   if (getHeading() != heading) {
-    current_options.set_heading(heading);
+    globals->get_options()->set_heading(heading);
     current_aircraft.fdm_state->set_Euler_Angles(getRoll() * DEG_TO_RAD,
                                                 getPitch() * DEG_TO_RAD,
                                                 heading * DEG_TO_RAD);
@@ -639,7 +639,7 @@ void
 FGBFI::setPitch (double pitch)
 {
   if (getPitch() != pitch) {
-    current_options.set_pitch(pitch);
+    globals->get_options()->set_pitch(pitch);
     current_aircraft.fdm_state->set_Euler_Angles(getRoll() * DEG_TO_RAD,
                                                 pitch * DEG_TO_RAD,
                                                 getHeading() * DEG_TO_RAD);
@@ -665,7 +665,7 @@ void
 FGBFI::setRoll (double roll)
 {
   if (getRoll() != roll) {
-    current_options.set_roll(roll);
+    globals->get_options()->set_roll(roll);
     current_aircraft.fdm_state->set_Euler_Angles(roll * DEG_TO_RAD,
                                                 getPitch() * DEG_TO_RAD,
                                                 getHeading() * DEG_TO_RAD);
@@ -769,7 +769,7 @@ void
 FGBFI::setSpeedNorth (double speed)
 {
   if (getSpeedNorth() != speed) {
-    current_options.set_uBody(speed);
+    globals->get_options()->set_uBody(speed);
     current_aircraft.fdm_state->set_Velocities_Local(speed,
                                                     getSpeedEast(),
                                                     getSpeedDown());
@@ -795,7 +795,7 @@ void
 FGBFI::setSpeedEast (double speed)
 {
   if (getSpeedEast() != speed) {
-    current_options.set_vBody(speed);
+    globals->get_options()->set_vBody(speed);
     current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
                                                     speed,
                                                     getSpeedDown());
@@ -821,7 +821,7 @@ void
 FGBFI::setSpeedDown (double speed)
 {
   if (getSpeedDown() != speed) {
-    current_options.set_wBody(speed);
+    globals->get_options()->set_wBody(speed);
     current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
                                                     getSpeedEast(),
                                                     speed);
@@ -1530,7 +1530,7 @@ FGBFI::getTargetAirport ()
 {
   // FIXME: not thread-safe
   static string out;
-  out = current_options.get_airport_id();
+  out = globals->get_options()->get_airport_id();
 
   return out;
 }
@@ -1543,7 +1543,7 @@ void
 FGBFI::setTargetAirport (const string &airportId)
 {
   // cout << "setting target airport id = " << airportId << endl;
-  current_options.set_airport_id(airportId);
+  globals->get_options()->set_airport_id(airportId);
 }
 
 
@@ -1604,7 +1604,7 @@ FGBFI::getVisibility ()
 bool
 FGBFI::getClouds ()
 {
-  return current_options.get_clouds();
+  return globals->get_options()->get_clouds();
 }
 
 
@@ -1614,7 +1614,7 @@ FGBFI::getClouds ()
 double
 FGBFI::getCloudsASL ()
 {
-  return current_options.get_clouds_asl();
+  return globals->get_options()->get_clouds_asl();
 }
 
 
@@ -1640,7 +1640,7 @@ FGBFI::setClouds (bool clouds)
 {
   if (getClouds() != clouds) {
     cout << "Set clouds to " << clouds << endl;
-    current_options.set_clouds(clouds);
+    globals->get_options()->set_clouds(clouds);
     needReinit();
   }
 }
@@ -1653,7 +1653,7 @@ void
 FGBFI::setCloudsASL (double cloudsASL)
 {
   if (getCloudsASL() != cloudsASL) {
-    current_options.set_clouds_asl(cloudsASL);
+    globals->get_options()->set_clouds_asl(cloudsASL);
     needReinit();
   }
 }
index b0ab0d5164232af6b699f44c05f6e787d1774fd2..a1426e0c6084199acdb2a2595698132594fe3bd7 100644 (file)
@@ -109,21 +109,21 @@ extern const char *default_root;
 bool fgInitFGRoot ( int argc, char **argv ) {
     // Attempt to locate and parse a config file
     // First check fg_root
-    FGPath config( current_options.get_fg_root() );
+    FGPath config( globals->get_options()->get_fg_root() );
     config.append( "system.fgfsrc" );
-    current_options.scan_config_file_for_root( config.str() );
+    globals->get_options()->scan_config_file_for_root( config.str() );
 
     // Next check home directory
     char* envp = ::getenv( "HOME" );
     if ( envp != NULL ) {
        config.set( envp );
        config.append( ".fgfsrc" );
-       current_options.scan_config_file_for_root( config.str() );
+       globals->get_options()->scan_config_file_for_root( config.str() );
     }
 
     // Parse remaining command line options
     // These will override anything specified in a config file
-    current_options.scan_command_line_for_root(argc, argv);
+    globals->get_options()->scan_command_line_for_root(argc, argv);
 
     return true;
 }
@@ -133,26 +133,26 @@ bool fgInitFGRoot ( int argc, char **argv ) {
 bool fgInitConfig ( int argc, char **argv ) {
     // Attempt to locate and parse a config file
     // First check fg_root
-    FGPath config( current_options.get_fg_root() );
+    FGPath config( globals->get_options()->get_fg_root() );
     config.append( "system.fgfsrc" );
-    current_options.parse_config_file( config.str() );
+    globals->get_options()->parse_config_file( config.str() );
 
     // Next check home directory
     char* envp = ::getenv( "HOME" );
     if ( envp != NULL ) {
        config.set( envp );
        config.append( ".fgfsrc" );
-       current_options.parse_config_file( config.str() );
+       globals->get_options()->parse_config_file( config.str() );
     }
 
     // Parse remaining command line options
     // These will override anything specified in a config file
-    if ( current_options.parse_command_line(argc, argv) !=
-        fgOPTIONS::FG_OPTIONS_OK )
+    if ( globals->get_options()->parse_command_line(argc, argv) !=
+        FGOptions::FG_OPTIONS_OK )
     {
        // Something must have gone horribly wrong with the command
        // line parsing or maybe the user just requested help ... :-)
-       current_options.usage();
+       globals->get_options()->usage();
        FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
        return false;
     }
@@ -164,7 +164,7 @@ bool fgInitConfig ( int argc, char **argv ) {
 // find basic airport location info from airport database
 bool fgFindAirportID( const string& id, FGAirport *a ) {
     if ( id.length() ) {
-       FGPath path( current_options.get_fg_root() );
+       FGPath path( globals->get_options()->get_fg_root() );
        path.append( "Airports" );
        path.append( "simple.mk4" );
        FGAirports airports( path.c_str() );
@@ -198,8 +198,8 @@ bool fgSetPosFromAirportID( const string& id ) {
            "Attempting to set starting position from airport code " << id );
 
     if ( fgFindAirportID( id, &a ) ) {
-       current_options.set_lon( a.longitude );
-       current_options.set_lat( a.latitude );
+       globals->get_options()->set_lon( a.longitude );
+       globals->get_options()->set_lat( a.latitude );
        current_properties.setDoubleValue("/position/longitude",
                                          a.longitude);
        current_properties.setDoubleValue("/position/latitude",
@@ -227,7 +227,7 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
     if ( id.length() ) {
        // set initial position from runway and heading
 
-       FGPath path( current_options.get_fg_root() );
+       FGPath path( globals->get_options()->get_fg_root() );
        path.append( "Airports" );
        path.append( "runways.mk4" );
        FGRunways runways( path.c_str() );
@@ -236,12 +236,12 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
                "Attempting to set starting position from runway code "
                << id << " heading " << tgt_hdg );
 
-       // FGPath inpath( current_options.get_fg_root() );
+       // FGPath inpath( globals->get_options()->get_fg_root() );
        // inpath.append( "Airports" );
        // inpath.append( "apt_simple" );
        // airports.load( inpath.c_str() );
 
-       // FGPath outpath( current_options.get_fg_root() );
+       // FGPath outpath( globals->get_options()->get_fg_root() );
        // outpath.append( "Airports" );
        // outpath.append( "simple.gdbm" );
        // airports.dump_gdbm( outpath.c_str() );
@@ -309,9 +309,9 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
     geo_direct_wgs_84 ( 0, found_r.lat, found_r.lon, 
                        azimuth, found_r.length * FEET_TO_METER * 0.5 - 5.0,
                        &lat2, &lon2, &az2 );
-    current_options.set_lon( lon2 );
-    current_options.set_lat( lat2 );
-    current_options.set_heading( heading );
+    globals->get_options()->set_lon( lon2 );
+    globals->get_options()->set_lat( lat2 );
+    globals->get_options()->set_heading( heading );
     current_properties.setDoubleValue("/position/longitude", lon2);
     current_properties.setDoubleValue("/position/latitude", lat2);
     current_properties.setDoubleValue("/orientation/heading", heading);
@@ -329,21 +329,21 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
 // Set initial position and orientation
 bool fgInitPosition( void ) {
     FGInterface *f = current_aircraft.fdm_state;
-    string id = current_options.get_airport_id();
+    string id = globals->get_options()->get_airport_id();
 
     // set initial position from default or command line coordinates
-    f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
-    f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
+    f->set_Longitude( globals->get_options()->get_lon() * DEG_TO_RAD );
+    f->set_Latitude( globals->get_options()->get_lat() * DEG_TO_RAD );
 
-    if ( scenery.cur_elev > current_options.get_altitude() - 1) {
-       current_options.set_altitude( scenery.cur_elev + 1 );
+    if ( scenery.cur_elev > globals->get_options()->get_altitude() - 1) {
+       globals->get_options()->set_altitude( scenery.cur_elev + 1 );
     }
 
     FG_LOG( FG_GENERAL, FG_INFO,
-           "starting altitude is = " << current_options.get_altitude() );
+           "starting altitude is = " << globals->get_options()->get_altitude() );
 
-    f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
-    fgFDMSetGroundElevation( current_options.get_flight_model(),
+    f->set_Altitude( globals->get_options()->get_altitude() * METER_TO_FEET );
+    fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
                             f->get_Altitude() * FEET_TO_METER );
 
 #if 0
@@ -376,7 +376,7 @@ bool fgInitGeneral( void ) {
     FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" );
     FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" );
 
-    root = current_options.get_fg_root();
+    root = globals->get_options()->get_fg_root();
     if ( ! root.length() ) {
        // No root path set? Then bail ...
        FG_LOG( FG_GENERAL, FG_ALERT,
@@ -416,7 +416,7 @@ bool fgInitSubsystems( void ) {
     FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
 
     // Initialize the material property lib
-    FGPath mpath( current_options.get_fg_root() );
+    FGPath mpath( globals->get_options()->get_fg_root() );
     mpath.append( "materials" );
     if ( material_lib.load( mpath.str() ) ) {
     } else {
@@ -434,8 +434,8 @@ bool fgInitSubsystems( void ) {
 
     if ( global_tile_mgr.init() ) {
        // Load the local scenery data
-       global_tile_mgr.update( current_options.get_lon(),
-                               current_options.get_lat() );
+       global_tile_mgr.update( globals->get_options()->get_lon(),
+                               globals->get_options()->get_lat() );
     } else {
        FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
        exit(-1);
@@ -445,19 +445,19 @@ bool fgInitSubsystems( void ) {
            "Current terrain elevation after tile mgr init " <<
            scenery.cur_elev );
 
-    if ( current_options.get_flight_model() == FGInterface::FG_LARCSIM ) {
+    if ( globals->get_options()->get_flight_model() == FGInterface::FG_LARCSIM ) {
        cur_fdm_state = new FGLaRCsim;
-    } else if ( current_options.get_flight_model() == FGInterface::FG_JSBSIM ) {
+    } else if ( globals->get_options()->get_flight_model() == FGInterface::FG_JSBSIM ) {
        cur_fdm_state = new FGJSBsim;
-    } else if ( current_options.get_flight_model() == FGInterface::FG_ADA ) {
+    } else if ( globals->get_options()->get_flight_model() == FGInterface::FG_ADA ) {
        cur_fdm_state = new FGADA;
-    } else if ( current_options.get_flight_model() == 
+    } else if ( globals->get_options()->get_flight_model() == 
                FGInterface::FG_BALLOONSIM ) {
        cur_fdm_state = new FGBalloonSim;
-    } else if ( current_options.get_flight_model() == 
+    } else if ( globals->get_options()->get_flight_model() == 
                FGInterface::FG_MAGICCARPET ) {
        cur_fdm_state = new FGMagicCarpet;
-    } else if ( current_options.get_flight_model() == 
+    } else if ( globals->get_options()->get_flight_model() == 
                FGInterface::FG_EXTERNAL ) {
        cur_fdm_state = new FGExternal;
     } else {
@@ -496,7 +496,7 @@ bool fgInitSubsystems( void ) {
            "Altitude after update " << scenery.cur_elev );
     */
 
-    fgFDMSetGroundElevation( current_options.get_flight_model(),
+    fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
                             scenery.cur_elev );
 
     // Reset our altitude if we are below ground
@@ -538,14 +538,14 @@ bool fgInitSubsystems( void ) {
     // and should really be read in from one or more files.
 
     // Initial Velocity
-    cur_fdm_state->set_Velocities_Local( current_options.get_uBody(),
-                             current_options.get_vBody(),
-                             current_options.get_wBody());
+    cur_fdm_state->set_Velocities_Local( globals->get_options()->get_uBody(),
+                             globals->get_options()->get_vBody(),
+                             globals->get_options()->get_wBody());
 
     // Initial Orientation
-    cur_fdm_state->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
-                        current_options.get_pitch() * DEG_TO_RAD,
-                        current_options.get_heading() * DEG_TO_RAD );
+    cur_fdm_state->set_Euler_Angles( globals->get_options()->get_roll() * DEG_TO_RAD,
+                        globals->get_options()->get_pitch() * DEG_TO_RAD,
+                        globals->get_options()->get_heading() * DEG_TO_RAD );
 
     // Initial Angular Body rates
     cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
@@ -622,7 +622,7 @@ bool fgInitSubsystems( void ) {
               current_aircraft.fdm_state->get_Longitude(),
               current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
     FGLocalWeatherDatabase::theFGLocalWeatherDatabase = 
-       new FGLocalWeatherDatabase( position, current_options.get_fg_root() );
+       new FGLocalWeatherDatabase( position, globals->get_options()->get_fg_root() );
     // cout << theFGLocalWeatherDatabase << endl;
     // cout << "visibility = " 
     //      << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;
@@ -641,19 +641,19 @@ bool fgInitSubsystems( void ) {
 
     FG_LOG(FG_GENERAL, FG_INFO, "  VOR/NDB");
     current_navlist = new FGNavList;
-    FGPath p_nav( current_options.get_fg_root() );
+    FGPath p_nav( globals->get_options()->get_fg_root() );
     p_nav.append( "Navaids/default.nav" );
     current_navlist->init( p_nav );
 
     FG_LOG(FG_GENERAL, FG_INFO, "  ILS");
     current_ilslist = new FGILSList;
-    FGPath p_ils( current_options.get_fg_root() );
+    FGPath p_ils( globals->get_options()->get_fg_root() );
     p_ils.append( "Navaids/default.ils" );
     current_ilslist->init( p_ils );
 
     FG_LOG(FG_GENERAL, FG_INFO, "  Fixes");
     current_fixlist = new FGFixList;
-    FGPath p_fix( current_options.get_fg_root() );
+    FGPath p_fix( globals->get_options()->get_fg_root() );
     p_fix.append( "Navaids/default.fix" );
     current_fixlist->init( p_fix );
 
@@ -706,9 +706,9 @@ bool fgInitSubsystems( void ) {
     // Initialize the flight model subsystem data structures base on
     // above values
 
-    // fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
-    //            1.0 / current_options.get_model_hz() );
-    if ( cur_fdm_state->init( 1.0 / current_options.get_model_hz() ) ) {
+    // fgFDMInit( globals->get_options()->get_flight_model(), cur_fdm_state,
+    //            1.0 / globals->get_options()->get_model_hz() );
+    if ( cur_fdm_state->init( 1.0 / globals->get_options()->get_model_hz() ) ) {
        // fdm init successful
     } else {
        FG_LOG( FG_GENERAL, FG_ALERT, "FDM init() failed!  Cannot continue." );
@@ -780,8 +780,8 @@ void fgReInitSubsystems( void )
     
     if( global_tile_mgr.init() ) {
        // Load the local scenery data
-       global_tile_mgr.update( current_options.get_lon(),
-                               current_options.get_lat() );
+       global_tile_mgr.update( globals->get_options()->get_lon(),
+                               globals->get_options()->get_lat() );
     } else {
        FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
                exit(-1);
@@ -790,7 +790,7 @@ void fgReInitSubsystems( void )
     // cout << "current scenery elev = " << scenery.cur_elev << endl;
 
     fgInitPosition();
-    fgFDMSetGroundElevation( current_options.get_flight_model(), 
+    fgFDMSetGroundElevation( globals->get_options()->get_flight_model(), 
                             scenery.cur_elev );
 
     // Reset our altitude if we are below ground
@@ -821,14 +821,14 @@ void fgReInitSubsystems( void )
     // and should really be read in from one or more files.
 
     // Initial Velocity
-    cur_fdm_state->set_Velocities_Local( current_options.get_uBody(),
-                             current_options.get_vBody(),
-                             current_options.get_wBody());
+    cur_fdm_state->set_Velocities_Local( globals->get_options()->get_uBody(),
+                             globals->get_options()->get_vBody(),
+                             globals->get_options()->get_wBody());
 
     // Initial Orientation
-    cur_fdm_state->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
-                        current_options.get_pitch() * DEG_TO_RAD,
-                        current_options.get_heading() * DEG_TO_RAD );
+    cur_fdm_state->set_Euler_Angles( globals->get_options()->get_roll() * DEG_TO_RAD,
+                        globals->get_options()->get_pitch() * DEG_TO_RAD,
+                        globals->get_options()->get_heading() * DEG_TO_RAD );
 
     // Initial Angular Body rates
     cur_fdm_state->set_Omega_Body( 7.206685E-05, 0.0, 9.492658E-05 );
@@ -854,9 +854,9 @@ void fgReInitSubsystems( void )
     FG_LOG( FG_GENERAL, FG_DEBUG, "  abs_view_pos = "
            << globals->get_current_view()->get_abs_view_pos());
 
-    // fgFDMInit( current_options.get_flight_model(), cur_fdm_state, 
-    //            1.0 / current_options.get_model_hz() );
-    cur_fdm_state->init( 1.0 / current_options.get_model_hz() );
+    // fgFDMInit( globals->get_options()->get_flight_model(), cur_fdm_state, 
+    //            1.0 / globals->get_options()->get_model_hz() );
+    cur_fdm_state->init( 1.0 / globals->get_options()->get_model_hz() );
 
     scenery.cur_elev = cur_fdm_state->get_Runway_altitude() * FEET_TO_METER;
 
index df407856a7ed73e551b1df50b459fa48c94d9227..a0ef346af5fd58afa6508fa8f7db0103d1fbe6bc 100644 (file)
@@ -59,13 +59,13 @@ void fgReInitSubsystems( void );
 // find basic airport location info from airport database
 bool fgFindAirportID( const string& id, FGAirport *a );
 
-// Set current_options lon/lat given an airport id
+// Set pos given an airport id
 bool fgSetPosFromAirportID( const string& id );
 
-// Set current_options lon/lat given an airport id and heading (degrees)
+// Set position and heading given an airport id and heading (degrees)
 bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg );
 
 
-#endif // _FG_INIT_H
+#endif // _FG_INIT_HXX
 
 
index f57dac4868c9c7a62027e2717c3dff3b31ee8d77..aa4b280cf0c710591129730fc2748c84edc0e70c 100644 (file)
@@ -32,8 +32,6 @@
 #include <simgear/io/sg_socket.hxx>
 #include <simgear/math/sg_types.hxx>
 
-#include <Main/options.hxx>
-
 #include <Network/protocol.hxx>
 #include <Network/native.hxx>
 #include <Network/garmin.hxx>
@@ -46,6 +44,8 @@
 
 #include <Time/timestamp.hxx>
 
+#include "globals.hxx"
+
 FG_USING_STD(string);
 
 
@@ -196,7 +196,7 @@ static FGProtocol *parse_port_config( const string& config )
 void fgIOInit() {
     FGProtocol *p;
     string_list channel_options_list = 
-       current_options.get_channel_options_list();
+       globals->get_options()->get_channel_options_list();
 
     // we could almost do this in a single step except pushing a valid
     // port onto the port list copies the structure and destroys the
index c9f5691df85630f19adb21f60421708666770843..85528de63efd7a0542de1ba000a94ea6b202a5c3 100644 (file)
@@ -30,6 +30,7 @@
 #include <simgear/route/route.hxx>
 #include <simgear/timing/sg_time.hxx>
 
+#include "options.hxx"
 #include "viewer.hxx"
 
 
@@ -60,6 +61,10 @@ private:
     // Global autopilot "route"
     SGRoute *route;
 
+    // options
+    FGOptions *options;
+
+    // viewers
     FGViewer *pilot_view;
     FGViewer *current_view;
 
@@ -91,6 +96,9 @@ public:
     inline SGRoute *get_route() const { return route; }
     inline void set_route( SGRoute *r ) { route = r; }
 
+    inline FGOptions *get_options() const { return options; }
+    inline void set_options( FGOptions *o ) { options = o; }
+
     inline FGViewer *get_pilot_view() const { return pilot_view; }
     inline void set_pilot_view( FGViewer *v ) { pilot_view = v; }
     
index 217765f943ad226a760e372ba9c68299b73bfeb3..d68c574eec201337ce99013649028d44c7c9552d 100644 (file)
@@ -151,77 +151,93 @@ void GLUTkey(unsigned char k, int x, int y) {
            // unflipping yourself :-)
            {
                double alt = cur_fdm_state->get_Altitude() + 1000;
-               fgFDMForceAltitude( current_options.get_flight_model(), 
+               fgFDMForceAltitude( globals->get_options()->get_flight_model(), 
                                    alt * FEET_TO_METER );
            }
            return;
        case 49: // numeric keypad 1
            v->set_goal_view_offset( FG_PI * 0.75 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
-             v->set_view_offset( FG_PI * 0.75 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
+               v->set_view_offset( FG_PI * 0.75 );
            }
            return;
        case 50: // numeric keypad 2
            v->set_goal_view_offset( FG_PI );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
-             v->set_view_offset( FG_PI );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
+               v->set_view_offset( FG_PI );
            }
            return;
        case 51: // numeric keypad 3
            v->set_goal_view_offset( FG_PI * 1.25 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
-             v->set_view_offset( FG_PI * 1.25 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
+               v->set_view_offset( FG_PI * 1.25 );
            }
            return;
        case 52: // numeric keypad 4
            v->set_goal_view_offset( FG_PI * 0.50 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
-             v->set_view_offset( FG_PI * 0.50 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
+               v->set_view_offset( FG_PI * 0.50 );
            }
            return;
        case 54: // numeric keypad 6
            v->set_goal_view_offset( FG_PI * 1.50 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
-             v->set_view_offset( FG_PI * 1.50 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
+               v->set_view_offset( FG_PI * 1.50 );
            }
            return;
        case 55: // numeric keypad 7
            v->set_goal_view_offset( FG_PI * 0.25 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
-             v->set_view_offset( FG_PI * 0.25 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
+               v->set_view_offset( FG_PI * 0.25 );
            }
            return;
        case 56: // numeric keypad 8
            v->set_goal_view_offset( 0.00 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
-             v->set_view_offset( 0.00 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
+               v->set_view_offset( 0.00 );
            }
            return;
        case 57: // numeric keypad 9
            v->set_goal_view_offset( FG_PI * 1.75 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
-             v->set_view_offset( FG_PI * 1.75 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
+               v->set_view_offset( FG_PI * 1.75 );
            }
            return;
        case 65: // A key
-           speed = current_options.get_speed_up();
+           speed = globals->get_options()->get_speed_up();
            speed--;
            if ( speed < 1 ) {
                speed = 1;
            }
-           current_options.set_speed_up( speed );
+           globals->get_options()->set_speed_up( speed );
            return;
        case 72: // H key
-           // status = current_options.get_hud_status();
-           // current_options.set_hud_status(!status);
+           // status = globals->get_options()->get_hud_status();
+           // globals->get_options()->set_hud_status(!status);
            HUD_brightkey( true );
            return;
        case 73: // I key
@@ -233,7 +249,7 @@ void GLUTkey(unsigned char k, int x, int y) {
            fgUpdateSkyAndLightingParams();
            return;
        case 80: // P key
-           current_options.toggle_panel();
+           globals->get_options()->toggle_panel();
            break;
        case 84: // T key
            globals->inc_warp_delta( -30 );
@@ -249,12 +265,12 @@ void GLUTkey(unsigned char k, int x, int y) {
 #endif
            return;
        case 88: // X key
-           fov = current_options.get_fov();
+           fov = globals->get_options()->get_fov();
            fov *= 1.05;
            if ( fov > FG_FOV_MAX ) {
                fov = FG_FOV_MAX;
            }
-           current_options.set_fov(fov);
+           globals->get_options()->set_fov(fov);
            v->force_update_fov_math();
            return;
        case 90: // Z key
@@ -342,9 +358,9 @@ void GLUTkey(unsigned char k, int x, int y) {
                    "Set flaps to " << controls.get_flaps() );
            return;
        case 97: // a key
-           speed = current_options.get_speed_up();
+           speed = globals->get_options()->get_speed_up();
            speed++;
-           current_options.set_speed_up( speed );
+           globals->get_options()->set_speed_up( speed );
            return;
        case 98: // b key
            int b_ret;
@@ -383,7 +399,7 @@ void GLUTkey(unsigned char k, int x, int y) {
            {
                FGBucket p( f->get_Longitude() * RAD_TO_DEG,
                            f->get_Latitude() * RAD_TO_DEG );
-               FGPath tile_path( current_options.get_fg_root() );
+               FGPath tile_path( globals->get_options()->get_fg_root() );
                tile_path.append( "Scenery" );
                tile_path.append( p.gen_base_path() );
                tile_path.append( p.gen_index_str() );
@@ -406,28 +422,31 @@ void GLUTkey(unsigned char k, int x, int y) {
            fgUpdateSkyAndLightingParams();
            return;
        case 118: // v key
-//         current_options.cycle_view_mode();
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             current_options.set_view_mode(fgOPTIONS::FG_VIEW_PILOT);
-             v->set_goal_view_offset( 0.0 );
-             v->set_view_offset( 0.0 );
-           } else if (current_options.get_view_mode() ==
-                      fgOPTIONS::FG_VIEW_PILOT) {
-             current_options.set_view_mode(fgOPTIONS::FG_VIEW_FOLLOW);
-             v->set_goal_view_offset( FG_PI * 1.75 );
-             v->set_view_offset( FG_PI * 1.75 );
-             globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
+//         globals->get_options()->cycle_view_mode();
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_options()->set_view_mode(FGOptions::FG_VIEW_PILOT);
+               v->set_goal_view_offset( 0.0 );
+               v->set_view_offset( 0.0 );
+           } else if ( globals->get_options()->get_view_mode() ==
+                       FGOptions::FG_VIEW_PILOT )
+           {
+               globals->get_options()->set_view_mode( FGOptions::FG_VIEW_FOLLOW );
+               v->set_goal_view_offset( FG_PI * 1.75 );
+               v->set_view_offset( FG_PI * 1.75 );
+               globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
            }
            fgReshape( globals->get_current_view()->get_winWidth(),
                       globals->get_current_view()->get_winHeight() );
            return;
        case 120: // x key
-           fov = current_options.get_fov();
+           fov = globals->get_options()->get_fov();
            fov /= 1.05;
            if ( fov < FG_FOV_MIN ) {
                fov = FG_FOV_MIN;
            }
-           current_options.set_fov(fov);
+           globals->get_options()->set_fov(fov);
            v->force_update_fov_math();
            return;
        case 122: // z key
@@ -506,7 +525,7 @@ void GLUTspecialkey(int k, int x, int y) {
          return;
        }
        case GLUT_KEY_F4: {
-         FGPath props_path(current_options.get_fg_root());
+         FGPath props_path(globals->get_options()->get_fg_root());
          props_path.append("preferences.xml");
          FG_LOG(FG_INPUT, FG_INFO, "Rereading global preferences");
          if (!readPropertyList(props_path.str(), &current_properties)) {
@@ -540,58 +559,74 @@ void GLUTspecialkey(int k, int x, int y) {
        }
        case GLUT_KEY_END: // numeric keypad 1
            v->set_goal_view_offset( FG_PI * 0.75 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
-             v->set_view_offset( FG_PI * 0.75 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW)
+           {
+               globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
+               v->set_view_offset( FG_PI * 0.75 );
            }
            return;
        case GLUT_KEY_DOWN: // numeric keypad 2
            v->set_goal_view_offset( FG_PI );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
-             v->set_view_offset( FG_PI );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
+               v->set_view_offset( FG_PI );
            }
            return;
        case GLUT_KEY_PAGE_DOWN: // numeric keypad 3
            v->set_goal_view_offset( FG_PI * 1.25 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
-             v->set_view_offset( FG_PI * 1.25 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW)
+           {
+               globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
+               v->set_view_offset( FG_PI * 1.25 );
            }
            return;
        case GLUT_KEY_LEFT: // numeric keypad 4
            v->set_goal_view_offset( FG_PI * 0.50 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
-             v->set_view_offset( FG_PI * 0.50 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
+               v->set_view_offset( FG_PI * 0.50 );
            }
            return;
        case GLUT_KEY_RIGHT: // numeric keypad 6
            v->set_goal_view_offset( FG_PI * 1.50 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
-             v->set_view_offset( FG_PI * 1.50 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
+               v->set_view_offset( FG_PI * 1.50 );
            }
            return;
        case GLUT_KEY_HOME: // numeric keypad 7
            v->set_goal_view_offset( FG_PI * 0.25 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
-             v->set_view_offset( FG_PI * 0.25 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
+               v->set_view_offset( FG_PI * 0.25 );
            }
            return;
        case GLUT_KEY_UP: // numeric keypad 8
            v->set_goal_view_offset( 0.00 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
-             v->set_view_offset( 0.00 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
+               v->set_view_offset( 0.00 );
            }
            return;
        case GLUT_KEY_PAGE_UP: // numeric keypad 9
            v->set_goal_view_offset( FG_PI * 1.75 );
-           if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
-             globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
-             v->set_view_offset( FG_PI * 1.75 );
+           if ( globals->get_options()->get_view_mode() ==
+                FGOptions::FG_VIEW_FOLLOW )
+           {
+               globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
+               v->set_view_offset( FG_PI * 1.75 );
            }
            return;
        }
@@ -635,17 +670,19 @@ void GLUTspecialkey(int k, int x, int y) {
            }
            return;
        case GLUT_KEY_F8: // F8 toggles fog ... off fastest nicest...
-           current_options.cycle_fog();
+           globals->get_options()->cycle_fog();
        
-           if ( current_options.get_fog() == fgOPTIONS::FG_FOG_DISABLED ) {
+           if ( globals->get_options()->get_fog() ==
+                FGOptions::FG_FOG_DISABLED )
+           {
                FG_LOG( FG_INPUT, FG_INFO, "Fog disabled" );
-           } else if ( current_options.get_fog() == 
-                       fgOPTIONS::FG_FOG_FASTEST )
+           } else if ( globals->get_options()->get_fog() == 
+                       FGOptions::FG_FOG_FASTEST )
            {
                FG_LOG( FG_INPUT, FG_INFO, 
                        "Fog enabled, hint set to fastest" );
-           } else if ( current_options.get_fog() ==
-                       fgOPTIONS::FG_FOG_NICEST )
+           } else if ( globals->get_options()->get_fog() ==
+                       FGOptions::FG_FOG_NICEST )
            {
                FG_LOG( FG_INPUT, FG_INFO,
                        "Fog enabled, hint set to nicest" );
@@ -654,11 +691,11 @@ void GLUTspecialkey(int k, int x, int y) {
            return;
        case GLUT_KEY_F9: // F9 toggles textures on and off...
            FG_LOG( FG_INPUT, FG_INFO, "Toggling texture" );
-           if ( current_options.get_textures() ) {
-               current_options.set_textures( false );
+           if ( globals->get_options()->get_textures() ) {
+               globals->get_options()->set_textures( false );
                material_lib.set_step( 1 );
            } else {
-               current_options.set_textures( true );
+               globals->get_options()->set_textures( true );
                material_lib.set_step( 0 );
            }
            return;
index 63a2ec92ee19743fd27b8d740f31eaf2648e0047..ad156ab302df862bca5dbe93e62604707bf73ed5 100644 (file)
@@ -242,7 +242,7 @@ void fgInitVisuals( void ) {
 
 #ifndef GLUT_WRONG_VERSION
     // Go full screen if requested ...
-    if ( current_options.get_fullscreen() ) {
+    if ( globals->get_options()->get_fullscreen() ) {
        glutFullScreen();
     }
 #endif
@@ -261,14 +261,14 @@ void fgInitVisuals( void ) {
 
     // glFogi (GL_FOG_MODE, GL_LINEAR);
     glFogi (GL_FOG_MODE, GL_EXP2);
-    if ( (current_options.get_fog() == 1) || 
-        (current_options.get_shading() == 0) ) {
+    if ( (globals->get_options()->get_fog() == 1) || 
+        (globals->get_options()->get_shading() == 0) ) {
        // if fastest fog requested, or if flat shading force fastest
        glHint ( GL_FOG_HINT, GL_FASTEST );
-    } else if ( current_options.get_fog() == 2 ) {
+    } else if ( globals->get_options()->get_fog() == 2 ) {
        glHint ( GL_FOG_HINT, GL_NICEST );
     }
-    if ( current_options.get_wireframe() ) {
+    if ( globals->get_options()->get_wireframe() ) {
        // draw wire frame
        glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
     }
@@ -300,7 +300,7 @@ void fgRenderFrame( void ) {
     
     if ( idle_state != 1000 ) {
        // still initializing, draw the splash screen
-       if ( current_options.get_splash_screen() == 1 ) {
+       if ( globals->get_options()->get_splash_screen() == 1 ) {
            fgSplashUpdate(0.0);
        }
     } else {
@@ -317,13 +317,15 @@ void fgRenderFrame( void ) {
 
        // update view volume parameters
        // cout << "before pilot_view update" << endl;
-        if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW ) {
-         float * offset = globals->get_pilot_view()->get_pilot_offset();
-         globals->get_current_view()->set_pilot_offset( offset[0],
-                                                        offset[1],
-                                                        offset[2] );
+        if ( globals->get_options()->get_view_mode()
+            == FGOptions::FG_VIEW_FOLLOW )
+       {
+           float * offset = globals->get_pilot_view()->get_pilot_offset();
+           globals->get_current_view()->set_pilot_offset( offset[0],
+                                                          offset[1],
+                                                          offset[2] );
        } else {
-         globals->get_current_view()->set_pilot_offset(0.0, 0.0, 0.0);
+           globals->get_current_view()->set_pilot_offset(0.0, 0.0, 0.0);
        }
        globals->get_pilot_view()->UpdateViewParams(*cur_fdm_state);
        // cout << "after pilot_view update" << endl;
@@ -333,12 +335,12 @@ void fgRenderFrame( void ) {
        glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
 
        clear_mask = GL_DEPTH_BUFFER_BIT;
-       if ( current_options.get_wireframe() ) {
+       if ( globals->get_options()->get_wireframe() ) {
            clear_mask |= GL_COLOR_BUFFER_BIT;
        }
 
-       if ( current_options.get_skyblend() ) {
-           if ( current_options.get_textures() ) {
+       if ( globals->get_options()->get_skyblend() ) {
+           if ( globals->get_options()->get_textures() ) {
                // glClearColor(black[0], black[1], black[2], black[3]);
                glClearColor(l->adj_fog_color[0], l->adj_fog_color[1], 
                             l->adj_fog_color[2], l->adj_fog_color[3]);
@@ -382,8 +384,8 @@ void fgRenderFrame( void ) {
        thesky->modify_vis( cur_fdm_state->get_Altitude() * FEET_TO_METER,
                                
                            ( global_multi_loop * 
-                             current_options.get_speed_up() ) /
-                           (double)current_options.get_model_hz() );
+                             globals->get_options()->get_speed_up() ) /
+                           (double)globals->get_options()->get_model_hz() );
 
        double actual_visibility = thesky->get_visibility();
        // cout << "actual visibility = " << actual_visibility << endl;
@@ -407,7 +409,7 @@ void fgRenderFrame( void ) {
        }
  
        // update the sky dome
-       if ( current_options.get_skyblend() ) {
+       if ( globals->get_options()->get_skyblend() ) {
            sgVec3 view_pos;
            sgSetVec3( view_pos,
                       globals->get_current_view()->get_view_pos().x(),
@@ -471,7 +473,7 @@ void fgRenderFrame( void ) {
        }
 
        glEnable( GL_DEPTH_TEST );
-       if ( current_options.get_fog() > 0 ) {
+       if ( globals->get_options()->get_fog() > 0 ) {
            glEnable( GL_FOG );
            glFogi( GL_FOG_MODE, GL_EXP2 );
            glFogfv( GL_FOG_COLOR, l->adj_fog_color );
@@ -500,7 +502,7 @@ void fgRenderFrame( void ) {
 
        // glMatrixMode( GL_PROJECTION );
        // glLoadIdentity();
-       float fov = current_options.get_fov();
+       float fov = globals->get_options()->get_fov();
        // ssgSetFOV(fov * current_view.get_win_ratio(), fov);
        ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
 
@@ -516,13 +518,13 @@ void fgRenderFrame( void ) {
            ssgSetNearFar( 0.5f, 120000.0f );
        }
 
-       if ( current_options.get_view_mode() == 
-            fgOPTIONS::FG_VIEW_PILOT )
+       if ( globals->get_options()->get_view_mode() == 
+            FGOptions::FG_VIEW_PILOT )
         {
            // disable TuX
            penguin_sel->select(0);
-       } else if ( current_options.get_view_mode() == 
-                   fgOPTIONS::FG_VIEW_FOLLOW )
+       } else if ( globals->get_options()->get_view_mode() == 
+                   FGOptions::FG_VIEW_FOLLOW )
         {
            // select view matrix from front of view matrix queue
            // FGMat4Wrapper tmp = current_view.follow.front();
@@ -564,7 +566,7 @@ void fgRenderFrame( void ) {
        // $$$ end - added VS Renganthan 17 Oct 2K
 
 # ifdef FG_NETWORK_OLK
-       if ( current_options.get_network_olk() ) {
+       if ( globals->get_options()->get_network_olk() ) {
            sgCoord fgdpos;
            other = head->next;             /* put listpointer to start  */
            while ( other != tail) {        /* display all except myself */
@@ -647,14 +649,15 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
        current_autopilot->run();
 
        // printf("updating flight model x %d\n", multi_loop);
-       /* fgFDMUpdate( current_options.get_flight_model(), 
+       /* fgFDMUpdate( globals->get_options()->get_flight_model(), 
                     fdm_state, 
-                    multi_loop * current_options.get_speed_up(),
+                    multi_loop * globals->get_options()->get_speed_up(),
                     remainder ); */
-       cur_fdm_state->update( multi_loop * current_options.get_speed_up() );
-       FGSteam::update( multi_loop * current_options.get_speed_up() );
+       cur_fdm_state->update( multi_loop *
+                              globals->get_options()->get_speed_up() );
+       FGSteam::update( multi_loop * globals->get_options()->get_speed_up() );
     } else {
-       // fgFDMUpdate( current_options.get_flight_model(), 
+       // fgFDMUpdate( globals->get_options()->get_flight_model(), 
        //              fdm_state, 0, remainder );
        cur_fdm_state->update( 0 );
        FGSteam::update( 0 );
@@ -669,10 +672,12 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
        fdm_list.pop_front();
     }
 
-    if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_PILOT ) {
+    if ( globals->get_options()->get_view_mode() == FGOptions::FG_VIEW_PILOT ) {
        cur_view_fdm = *cur_fdm_state;
        // do nothing
-    } else if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW ) {
+    } else if ( globals->get_options()->get_view_mode()
+               == FGOptions::FG_VIEW_FOLLOW )
+    {
        cur_view_fdm = fdm_list.front();
     }
 
@@ -684,7 +689,8 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
            globals->get_current_view()->set_view_offset( globals->get_current_view()->get_goal_view_offset() );
            break;
        } else {
-           // move current_view.view_offset towards current_view.goal_view_offset
+           // move current_view.view_offset towards
+           // current_view.goal_view_offset
            if ( globals->get_current_view()->get_goal_view_offset() > 
                 globals->get_current_view()->get_view_offset() )
             {
@@ -697,7 +703,8 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
                }
            } else {
                if ( globals->get_current_view()->get_view_offset() - 
-                    globals->get_current_view()->get_goal_view_offset() < FG_PI )
+                    globals->get_current_view()->get_goal_view_offset() <
+                    FG_PI )
                 {
                    globals->get_current_view()->inc_view_offset( -0.01 );
                } else {
@@ -713,7 +720,8 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
     }
 
     double tmp = -(l->sun_rotation + FG_PI) 
-       - (cur_fdm_state->get_Psi() - globals->get_current_view()->get_view_offset() );
+       - (cur_fdm_state->get_Psi() -
+          globals->get_current_view()->get_view_offset() );
     while ( tmp < 0.0 ) {
        tmp += FG_2PI;
     }
@@ -741,7 +749,7 @@ void fgInitTimeDepCalcs( void ) {
     // initialize timer
 
     // #ifdef HAVE_SETITIMER
-    //   fgTimerInit( 1.0 / current_options.get_model_hz(), 
+    //   fgTimerInit( 1.0 / globals->get_options()->get_model_hz(), 
     //                fgUpdateTimeDepCalcs );
     // #endif HAVE_SETITIMER
 }
@@ -770,7 +778,7 @@ static void fgMainLoop( void ) {
     FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
 
 #ifdef FG_NETWORK_OLK
-    if ( current_options.get_network_olk() ) {
+    if ( globals->get_options()->get_network_olk() ) {
        if ( net_is_registered == 0 ) {      // We first have to reg. to fgd
            // printf("FGD: Netupdate\n");
            fgd_send_com( "A", FGFS_host);   // Send Mat4 data
@@ -781,7 +789,8 @@ static void fgMainLoop( void ) {
 
 #if defined( ENABLE_PLIB_JOYSTICK )
     // Read joystick and update control settings
-    if ( current_options.get_control_mode() == fgOPTIONS::FG_JOYSTICK ) {
+    if ( globals->get_options()->get_control_mode() == FGOptions::FG_JOYSTICK )
+    {
        fgJoystickRead();
     }
 #elif defined( ENABLE_GLUT_JOYSTICK )
@@ -810,14 +819,15 @@ static void fgMainLoop( void ) {
                   cur_fdm_state->get_Altitude() * FEET_TO_METER,
                   scenery.cur_elev + alt_adjust_m - 3.0,
                   scenery.cur_elev + alt_adjust_m );
-           fgFDMForceAltitude( current_options.get_flight_model(), 
+           fgFDMForceAltitude( globals->get_options()->get_flight_model(), 
                                scenery.cur_elev + alt_adjust_m );
 
            FG_LOG( FG_ALL, FG_DEBUG, 
                    "<*> resetting altitude to " 
-                   << cur_fdm_state->get_Altitude() * FEET_TO_METER << " meters" );
+                   << cur_fdm_state->get_Altitude() * FEET_TO_METER
+                   << " meters" );
        }
-       fgFDMSetGroundElevation( current_options.get_flight_model(),
+       fgFDMSetGroundElevation( globals->get_options()->get_flight_model(),
                                 scenery.cur_elev );  // meters
     }
 
@@ -887,9 +897,9 @@ static void fgMainLoop( void ) {
        elapsed += remainder;
 
        global_multi_loop = (int)(((double)elapsed * 0.000001) * 
-                          current_options.get_model_hz());
+                          globals->get_options()->get_model_hz());
        remainder = elapsed - ( (global_multi_loop*1000000) / 
-                               current_options.get_model_hz() );
+                               globals->get_options()->get_model_hz() );
        FG_LOG( FG_ALL, FG_DEBUG, 
                "Model iterations needed = " << global_multi_loop
                << ", new remainder = " << remainder );
@@ -917,9 +927,9 @@ static void fgMainLoop( void ) {
 
     // Run audio scheduler
 #ifdef ENABLE_AUDIO_SUPPORT
-    if ( current_options.get_sound() && !audio_sched->not_working() ) {
+    if ( globals->get_options()->get_sound() && !audio_sched->not_working() ) {
 
-       if ( current_options.get_aircraft() == "c172" ) {
+       if ( globals->get_options()->get_aircraft() == "c172" ) {
            // pitch corresponds to rpm
            // volume corresponds to manifold pressure
 
@@ -989,7 +999,7 @@ static void fgIdleFunction ( void ) {
 
     if ( idle_state == 0 ) {
        // Initialize the splash screen right away
-       if ( current_options.get_splash_screen() ) {
+       if ( globals->get_options()->get_splash_screen() ) {
            fgSplashInit();
        }
        
@@ -997,9 +1007,9 @@ static void fgIdleFunction ( void ) {
     } else if ( idle_state == 1 ) {
        // Start the intro music
 #if !defined(WIN32)
-       if ( current_options.get_intro_music() ) {
+       if ( globals->get_options()->get_intro_music() ) {
            string lockfile = "/tmp/mpg123.running";
-           FGPath mp3file( current_options.get_fg_root() );
+           FGPath mp3file( globals->get_options()->get_fg_root() );
            mp3file.append( "Sounds/intro.mp3" );
 
            string command = "(touch " + lockfile + "; mpg123 "
@@ -1054,7 +1064,7 @@ static void fgIdleFunction ( void ) {
 #ifdef ENABLE_AUDIO_SUPPORT
 
 #if !defined(WIN32)
-       if ( current_options.get_intro_music() ) {
+       if ( globals->get_options()->get_intro_music() ) {
            // Let's wait for mpg123 to finish
            string lockfile = "/tmp/mpg123.running";
            struct stat stat_buf;
@@ -1070,13 +1080,13 @@ static void fgIdleFunction ( void ) {
        }
 #endif // WIN32
 
-       if ( current_options.get_sound() ) {
+       if ( globals->get_options()->get_sound() ) {
            audio_sched = new slScheduler ( 8000 );
            audio_mixer = new smMixer;
            audio_mixer -> setMasterVolume ( 80 ) ;  /* 80% of max volume. */
            audio_sched -> setSafetyMargin ( 1.0 ) ;
 
-           FGPath slfile( current_options.get_fg_root() );
+           FGPath slfile( globals->get_options()->get_fg_root() );
            slfile.append( "Sounds/wasp.wav" );
 
            s1 = new slSample ( (char *)slfile.c_str() );
@@ -1118,7 +1128,7 @@ static void fgIdleFunction ( void ) {
 
        fgMainLoop();
     } else {
-       if ( current_options.get_splash_screen() == 1 ) {
+       if ( globals->get_options()->get_splash_screen() == 1 ) {
            fgSplashUpdate(0.0);
        }
     }
@@ -1128,13 +1138,15 @@ static void fgIdleFunction ( void ) {
 // Handle new window size or exposure
 void fgReshape( int width, int height ) {
     if ( ! fgPanelVisible() || idle_state != 1000 ) {
-       globals->get_current_view()->set_win_ratio( (float)height / (float)width );
+       globals->get_current_view()->set_win_ratio( (float)height /
+                                                   (float)width );
        glViewport(0, 0 , (GLint)(width), (GLint)(height) );
     } else {
         int view_h =
          int((current_panel->getViewHeight() - current_panel->getYOffset())
              * (height / 768.0)) + 1;
-       globals->get_current_view()->set_win_ratio( (float)view_h / (float)width );
+       globals->get_current_view()->set_win_ratio( (float)view_h /
+                                                   (float)width );
        glViewport(0, (GLint)(height - view_h),
                   (GLint)(width), (GLint)(view_h) );
     }
@@ -1144,12 +1156,12 @@ void fgReshape( int width, int height ) {
     globals->get_current_view()->force_update_fov_math();
 
     // set these fov to be the same as in fgRenderFrame()
-    // float x_fov = current_options.get_fov();
+    // float x_fov = globals->get_options()->get_fov();
     // float y_fov = x_fov * 1.0 / current_view.get_win_ratio();
     // ssgSetFOV( x_fov, y_fov );
 
     // glViewport ( 0, 0, width, height );
-    float fov = current_options.get_fov();
+    float fov = globals->get_options()->get_fov();
     // ssgSetFOV(fov * current_view.get_win_ratio(), fov);
     ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
 
@@ -1177,14 +1189,15 @@ int fgGlutInit( int *argc, char **argv ) {
     glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
 
     FG_LOG( FG_GENERAL, FG_INFO, "Opening a window: " <<
-           current_options.get_xsize() << "x" << current_options.get_ysize() );
+           globals->get_options()->get_xsize() << "x"
+           << globals->get_options()->get_ysize() );
 
     // Define initial window size
-    glutInitWindowSize( current_options.get_xsize(),
-                        current_options.get_ysize() );
+    glutInitWindowSize( globals->get_options()->get_xsize(),
+                        globals->get_options()->get_ysize() );
 
     // Initialize windows
-    if ( current_options.get_game_mode() == 0 ) {
+    if ( globals->get_options()->get_game_mode() == 0 ) {
        // Open the regular window
        glutCreateWindow("FlightGear");
 #ifndef GLUT_WRONG_VERSION
@@ -1192,9 +1205,9 @@ int fgGlutInit( int *argc, char **argv ) {
        // Open the cool new 'game mode' window
        char game_mode_str[256];
        sprintf( game_mode_str, "width=%d height=%d bpp=%d",
-                current_options.get_xsize(),
-                current_options.get_ysize(),
-                current_options.get_bpp());
+                globals->get_options()->get_xsize(),
+                globals->get_options()->get_ysize(),
+                globals->get_options()->get_bpp());
 
        FG_LOG( FG_GENERAL, FG_INFO, 
                "game mode params = " << game_mode_str );
@@ -1228,16 +1241,16 @@ int fgGlutInit( int *argc, char **argv ) {
            // probably a voodoo-2
            if ( renderer.find( "TMU/SLI" ) != string::npos ) {
                // probably two SLI'd Voodoo-2's
-               current_options.set_xsize( 1024 );
-               current_options.set_ysize( 768 );
+               globals->get_options()->set_xsize( 1024 );
+               globals->get_options()->set_ysize( 768 );
                FG_LOG( FG_GENERAL, FG_INFO,
                        "It looks like you have two sli'd voodoo-2's." << endl
                        << "upgrading your win resolution to 1024 x 768" );
                glutReshapeWindow(1024, 768);
            } else {
                // probably a single non-SLI'd Voodoo-2
-               current_options.set_xsize( 800 );
-               current_options.set_ysize( 600 );
+               globals->get_options()->set_xsize( 800 );
+               globals->get_options()->set_ysize( 600 );
                FG_LOG( FG_GENERAL, FG_INFO,
                        "It looks like you have a voodoo-2." << endl
                        << "upgrading your win resolution to 800 x 600" );
@@ -1302,14 +1315,28 @@ int main( int argc, char **argv ) {
     // seed the random number generater
     fg_srandom();
 
+    // needs to happen before we parse command line options
+    globals = new FGGlobals;
+
+    SGRoute *route = new SGRoute;
+    globals->set_route( route );
+
+    FGOptions *options = new FGOptions;
+    globals->set_options( options );
+
+    FGViewer *pv = new FGViewer;
+    globals->set_pilot_view( pv );
+    FGViewer *cv = new FGViewer;
+    globals->set_current_view( cv );
+    
     // Scan the config file(s) and command line options to see if
     // fg_root was specified (ignore all other options for now)
     fgInitFGRoot(argc, argv);
 
-    // cout << "1. airport_id = " << current_options.get_airport_id() << endl;
+    // cout << "1. airport_id = " << globals->get_options()->get_airport_id() << endl;
 
     // Read global preferences from $FG_ROOT/preferences.xml
-    FGPath props_path(current_options.get_fg_root());
+    FGPath props_path(globals->get_options()->get_fg_root());
     props_path.append("preferences.xml");
     FG_LOG(FG_INPUT, FG_INFO, "Reading global preferences");
     if (!readPropertyList(props_path.str(), &current_properties)) {
@@ -1319,20 +1346,11 @@ int main( int argc, char **argv ) {
       FG_LOG(FG_INPUT, FG_INFO, "Finished Reading global preferences");
     }
 
-    // cout << "2. airport_id = " << current_options.get_airport_id() << endl;
+    // cout << "2. airport_id = " << globals->get_options()->get_airport_id() << endl;
 
     // Initialize the Aircraft directory to "" (UIUC)
     aircraft_dir = "";
 
-    // needs to happen before we parse command line options
-    globals = new FGGlobals;
-    SGRoute *route = new SGRoute;
-    globals->set_route( route );
-    FGViewer *pv = new FGViewer;
-    globals->set_pilot_view( pv );
-    FGViewer *cv = new FGViewer;
-    globals->set_current_view( cv );
-    
     // Load the configuration parameters
     if ( !fgInitConfig(argc, argv) ) {
        FG_LOG( FG_GENERAL, FG_ALERT, "Config option parsing failed ..." );
@@ -1362,18 +1380,18 @@ int main( int argc, char **argv ) {
     guiInit();
 
     // set current_options lon/lat if an airport id is specified
-    // cout << "3. airport_id = " << current_options.get_airport_id() << endl;
-    if ( current_options.get_airport_id().length() ) {
-       // fgSetPosFromAirportID( current_options.get_airport_id() );
-       fgSetPosFromAirportIDandHdg( current_options.get_airport_id(),
-                                    current_options.get_heading() );
+    // cout << "3. airport_id = " << globals->get_options()->get_airport_id() << endl;
+    if ( globals->get_options()->get_airport_id().length() ) {
+       // fgSetPosFromAirportID( globals->get_options()->get_airport_id() );
+       fgSetPosFromAirportIDandHdg( globals->get_options()->get_airport_id(),
+                                    globals->get_options()->get_heading() );
     }
 
     // Initialize time
-    FGPath zone( current_options.get_fg_root() );
+    FGPath zone( globals->get_options()->get_fg_root() );
     zone.append( "Timezone" );
-    SGTime *t = new SGTime( current_options.get_lon() * DEG_TO_RAD,
-                           current_options.get_lat() * DEG_TO_RAD,
+    SGTime *t = new SGTime( globals->get_options()->get_lon() * DEG_TO_RAD,
+                           globals->get_options()->get_lat() * DEG_TO_RAD,
                            zone.str() );
 
     // Handle potential user specified time offsets
@@ -1384,27 +1402,29 @@ int main( int argc, char **argv ) {
        sgTimeGetGMT( fgLocaltime(&cur_time, t->get_zonename() ) );
 
     // Okay, we now have six possible scenarios
-    switch ( current_options.get_time_offset_type() ) {
-    case fgOPTIONS::FG_TIME_SYS_OFFSET:
-       globals->set_warp( current_options.get_time_offset() );
+    switch ( globals->get_options()->get_time_offset_type() ) {
+    case FGOptions::FG_TIME_SYS_OFFSET:
+       globals->set_warp( globals->get_options()->get_time_offset() );
        break;
-    case fgOPTIONS::FG_TIME_GMT_OFFSET:
-       globals->set_warp( current_options.get_time_offset() - 
+    case FGOptions::FG_TIME_GMT_OFFSET:
+       globals->set_warp( globals->get_options()->get_time_offset() - 
                           (currGMT - systemLocalTime) );
        break;
-    case fgOPTIONS::FG_TIME_LAT_OFFSET:
-       globals->set_warp( current_options.get_time_offset() - 
+    case FGOptions::FG_TIME_LAT_OFFSET:
+       globals->set_warp( globals->get_options()->get_time_offset() - 
                           (aircraftLocalTime - systemLocalTime) );
        break;
-    case fgOPTIONS::FG_TIME_SYS_ABSOLUTE:
-       globals->set_warp( current_options.get_time_offset() - cur_time );
+    case FGOptions::FG_TIME_SYS_ABSOLUTE:
+       globals->set_warp( globals->get_options()->get_time_offset() -
+                          cur_time );
        //printf("warp = %d\n", warp); 
        break;
-    case fgOPTIONS::FG_TIME_GMT_ABSOLUTE:
-       globals->set_warp( current_options.get_time_offset() - currGMT );
+    case FGOptions::FG_TIME_GMT_ABSOLUTE:
+       globals->set_warp( globals->get_options()->get_time_offset() -
+                          currGMT );
        break;
-    case fgOPTIONS::FG_TIME_LAT_ABSOLUTE:
-       globals->set_warp( current_options.get_time_offset() - 
+    case FGOptions::FG_TIME_LAT_ABSOLUTE:
+       globals->set_warp( globals->get_options()->get_time_offset() - 
                           (aircraftLocalTime - systemLocalTime) - 
                           cur_time ); 
        break;
@@ -1434,11 +1454,11 @@ int main( int argc, char **argv ) {
     // distribution) specifically from the ssg tux example
     //
 
-    FGPath modelpath( current_options.get_fg_root() );
+    FGPath modelpath( globals->get_options()->get_fg_root() );
     // modelpath.append( "Models" );
     // modelpath.append( "Geometry" );
   
-    FGPath texturepath( current_options.get_fg_root() );
+    FGPath texturepath( globals->get_options()->get_fg_root() );
     texturepath.append( "Models" );
     texturepath.append( "Textures" );
   
@@ -1450,7 +1470,7 @@ int main( int argc, char **argv ) {
     scene->setName( "Scene" );
 
     // Initialize the sky
-    FGPath ephem_data_path( current_options.get_fg_root() );
+    FGPath ephem_data_path( globals->get_options()->get_fg_root() );
     ephem_data_path.append( "Astro" );
     SGEphemeris *ephem = new SGEphemeris( ephem_data_path.c_str() );
     ephem->update( globals->get_time_params()->getMjd(),
@@ -1458,7 +1478,7 @@ int main( int argc, char **argv ) {
                   0.0 );
     globals->set_ephem( ephem );
 
-    FGPath sky_tex_path( current_options.get_fg_root() );
+    FGPath sky_tex_path( globals->get_options()->get_fg_root() );
     sky_tex_path.append( "Textures" );
     sky_tex_path.append( "Sky" );
     thesky = new SGSky;
@@ -1470,7 +1490,7 @@ int main( int argc, char **argv ) {
                   globals->get_ephem()->getNumStars(),
                   globals->get_ephem()->getStars(), 60000.0 );
 
-    if ( current_options.get_clouds() == true ) {
+    if ( globals->get_options()->get_clouds() == true ) {
        thesky->add_cloud_layer( 2600.0, 200.0, 50.0, 40000.0,
                                 SG_CLOUD_MOSTLY_SUNNY );
        thesky->add_cloud_layer( 6000.0, 20.0, 10.0, 40000.0,
@@ -1524,7 +1544,7 @@ int main( int argc, char **argv ) {
 
 #ifdef FG_NETWORK_OLK
     // Do the network intialization
-    if ( current_options.get_network_olk() ) {
+    if ( globals->get_options()->get_network_olk() ) {
        printf("Multipilot mode %s\n", fg_net_init( scene ) );
     }
 #endif
@@ -1548,7 +1568,7 @@ void fgLoadDCS(void) {
     int i = 1;
     string obj_filename;
 
-    FGPath tile_path( current_options.get_fg_root());
+    FGPath tile_path( globals->get_options()->get_fg_root());
     tile_path.append( "Scenery" );
     tile_path.append( "Objects.txt" );
     fg_gzifstream in( tile_path.str() );
@@ -1556,11 +1576,11 @@ void fgLoadDCS(void) {
        FG_LOG( FG_TERRAIN, FG_ALERT, "Cannot open file: " << tile_path.str() );
     }
 
-    FGPath modelpath( current_options.get_fg_root() );
+    FGPath modelpath( globals->get_options()->get_fg_root() );
     modelpath.append( "Models" );
     modelpath.append( "Geometry" );
   
-    FGPath texturepath( current_options.get_fg_root() );
+    FGPath texturepath( globals->get_options()->get_fg_root() );
     texturepath.append( "Models" );
     texturepath.append( "Textures" );
  
index 9bdf21b48832382478c480ffbd1fa51e104f8cd6..335cfe091e8bdf9ea5e4a8fafcaab998caf610f1 100644 (file)
@@ -88,11 +88,11 @@ atoi( const string& str )
 
 
 // Defined the shared options class here
-fgOPTIONS current_options;
+// FGOptions current_options;
 
 
 // Constructor
-fgOPTIONS::fgOPTIONS() :
+FGOptions::FGOptions() :
     // starting longitude in degrees (west = -)
     // starting latitude in degrees (south = -)
 
@@ -175,7 +175,7 @@ fgOPTIONS::fgOPTIONS() :
 
     // Rendering options
     fog(FG_FOG_NICEST),  // nicest
-    clouds(false),
+    clouds(true),
     clouds_asl(5000*FEET_TO_METER),
     fov(55.0),
     fullscreen(0),
@@ -185,6 +185,10 @@ fgOPTIONS::fgOPTIONS() :
     wireframe(0),
     xsize(800),
     ysize(600),
+    xmin(0),
+    ymin(0),
+    xmax(800),
+    ymax(600),
     bpp(16),
     view_mode(FG_VIEW_PILOT),
     default_view_offset(0),
@@ -243,7 +247,7 @@ fgOPTIONS::fgOPTIONS() :
 }
 
 void 
-fgOPTIONS::toggle_panel() {
+FGOptions::toggle_panel() {
     
     bool freeze = globals->get_freeze();
 
@@ -276,7 +280,7 @@ fgOPTIONS::toggle_panel() {
 }
 
 double
-fgOPTIONS::parse_time(const string& time_in) {
+FGOptions::parse_time(const string& time_in) {
     char *time_str, num[256];
     double hours, minutes, seconds;
     double result = 0.0;
@@ -354,7 +358,7 @@ fgOPTIONS::parse_time(const string& time_in) {
 }
 
 
-long int fgOPTIONS::parse_date( const string& date)
+long int FGOptions::parse_date( const string& date)
 {
     struct tm gmt;
     char * date_str, num[256];
@@ -462,7 +466,7 @@ long int fgOPTIONS::parse_date( const string& date)
 
 
 // parse degree in the form of [+/-]hhh:mm:ss
-void fgOPTIONS::parse_control( const string& mode ) {
+void FGOptions::parse_control( const string& mode ) {
     if ( mode == "joystick" ) {
        control_mode = FG_JOYSTICK;
     } else if ( mode == "mouse" ) {
@@ -475,7 +479,7 @@ void fgOPTIONS::parse_control( const string& mode ) {
 
 /// parse degree in the form of [+/-]hhh:mm:ss
 double
-fgOPTIONS::parse_degree( const string& degree_str) {
+FGOptions::parse_degree( const string& degree_str) {
     double result = parse_time( degree_str );
 
     // printf("Degree = %.4f\n", result);
@@ -486,7 +490,7 @@ fgOPTIONS::parse_degree( const string& degree_str) {
 
 // parse time offset command line option
 int
-fgOPTIONS::parse_time_offset( const string& time_str) {
+FGOptions::parse_time_offset( const string& time_str) {
     int result;
 
     // printf("time offset = %s\n", time_str);
@@ -506,7 +510,7 @@ fgOPTIONS::parse_time_offset( const string& time_str) {
 // Parse --tile-diameter=n type option 
 
 int
-fgOPTIONS::parse_tile_radius( const string& arg ) {
+FGOptions::parse_tile_radius( const string& arg ) {
     int radius = atoi( arg );
 
     if ( radius < FG_RADIUS_MIN ) { radius = FG_RADIUS_MIN; }
@@ -520,7 +524,7 @@ fgOPTIONS::parse_tile_radius( const string& arg ) {
 
 // Parse --fdm=abcdefg type option 
 int
-fgOPTIONS::parse_fdm( const string& fm ) {
+FGOptions::parse_fdm( const string& fm ) {
     // cout << "fdm = " << fm << endl;
 
     if ( fm == "ada" ) {
@@ -547,7 +551,7 @@ fgOPTIONS::parse_fdm( const string& fm ) {
 
 // Parse --fov=x.xx type option 
 double
-fgOPTIONS::parse_fov( const string& arg ) {
+FGOptions::parse_fov( const string& arg ) {
     double fov = atof(arg);
 
     if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
@@ -585,7 +589,7 @@ fgOPTIONS::parse_fov( const string& arg ) {
 //  filename = file system file name
 
 bool 
-fgOPTIONS::parse_channel( const string& type, const string& channel_str ) {
+FGOptions::parse_channel( const string& type, const string& channel_str ) {
     // cout << "Channel string = " << channel_str << endl;
 
     channel_options_list.push_back( type + "," + channel_str );
@@ -595,7 +599,7 @@ fgOPTIONS::parse_channel( const string& type, const string& channel_str ) {
 
 
 // Parse --wp=ID[,alt]
-bool fgOPTIONS::parse_wp( const string& arg ) {
+bool FGOptions::parse_wp( const string& arg ) {
     string id, alt_str;
     double alt = 0.0;
 
@@ -625,7 +629,7 @@ bool fgOPTIONS::parse_wp( const string& arg ) {
 
 
 // Parse a single option
-int fgOPTIONS::parse_option( const string& arg ) {
+int FGOptions::parse_option( const string& arg ) {
     // General Options
     if ( (arg == "--help") || (arg == "-h") ) {
        // help/usage request
@@ -822,6 +826,10 @@ int fgOPTIONS::parse_option( const string& arg ) {
            FG_LOG( FG_GENERAL, FG_ALERT,
                    "Setting geometry to " << xsize << 'x' << ysize << '\n');
        }
+
+       xmin = ymin = 0;
+       xmax = xsize;
+       ymax = ysize;
     } else if ( arg.find( "--bpp=" ) != string::npos ) {
        string bits_per_pix = arg.substr( 6 );
        if ( bits_per_pix == "16" ) {
@@ -926,7 +934,7 @@ int fgOPTIONS::parse_option( const string& arg ) {
 
 // Scan the command line options for an fg_root definition and set
 // just that.
-int fgOPTIONS::scan_command_line_for_root( int argc, char **argv ) {
+int FGOptions::scan_command_line_for_root( int argc, char **argv ) {
     int i = 1;
     int result;
 
@@ -948,7 +956,7 @@ int fgOPTIONS::scan_command_line_for_root( int argc, char **argv ) {
 
 
 // Scan the config file for an fg_root definition and set just that.
-int fgOPTIONS::scan_config_file_for_root( const string& path ) {
+int FGOptions::scan_config_file_for_root( const string& path ) {
     fg_gzifstream in( path );
     if ( !in.is_open() )
        return(FG_OPTIONS_ERROR);
@@ -985,7 +993,7 @@ int fgOPTIONS::scan_config_file_for_root( const string& path ) {
 
 
 // Parse the command line options
-int fgOPTIONS::parse_command_line( int argc, char **argv ) {
+int FGOptions::parse_command_line( int argc, char **argv ) {
     int i = 1;
     int result;
 
@@ -1007,7 +1015,7 @@ int fgOPTIONS::parse_command_line( int argc, char **argv ) {
 
 
 // Parse config file options
-int fgOPTIONS::parse_config_file( const string& path ) {
+int FGOptions::parse_config_file( const string& path ) {
     fg_gzifstream in( path );
     if ( !in.is_open() )
        return(FG_OPTIONS_ERROR);
@@ -1046,7 +1054,7 @@ int fgOPTIONS::parse_config_file( const string& path ) {
 
 
 // Print usage message
-void fgOPTIONS::usage ( void ) {
+void FGOptions::usage ( void ) {
     cout << "Usage: fg [ options ... ]" << endl;
     cout << endl;
 
@@ -1195,5 +1203,5 @@ void fgOPTIONS::usage ( void ) {
 
 
 // Destructor
-fgOPTIONS::~fgOPTIONS( void ) {
+FGOptions::~FGOptions( void ) {
 }
index f17f524996a83cab08b13fdc65810a87844fefa7..aaee9b9c1439dc481c0ae2a650bd9fab4b852389 100644 (file)
@@ -58,7 +58,7 @@ FG_USING_STD(string);
 #define NEW_DEFAULT_MODEL_HZ 120
 
 
-class fgOPTIONS {
+class FGOptions {
 
 public:
 
@@ -180,6 +180,8 @@ private:
     bool textures;      // Textures enabled/disabled
     bool wireframe;     // Wireframe mode enabled/disabled
     int xsize, ysize;   // window size derived from geometry string
+    int xmin, ymin;     // upper left corner of window to draw in
+    int xmax, ymax;     // lower right corner of window to draw in
     int bpp;            // bits per pixel
     fgViewMode view_mode; // view mode
     double default_view_offset;        // default forward view offset (for use by
@@ -212,8 +214,8 @@ private:
     
 public:
 
-    fgOPTIONS();
-    ~fgOPTIONS();
+    FGOptions();
+    ~FGOptions();
 
     // Parse a single option
     int parse_option( const string& arg );
@@ -286,6 +288,10 @@ public:
     inline bool get_wireframe() const { return wireframe; }
     inline int get_xsize() const { return xsize; }
     inline int get_ysize() const { return ysize; }
+    inline int get_xmin() const { return xmin; }
+    inline int get_ymin() const { return ymin; }
+    inline int get_xmax() const { return xmax; }
+    inline int get_ymax() const { return ymax; }
     inline int get_bpp() const { return bpp; }
     inline fgViewMode get_view_mode() const { return view_mode; }
     inline double get_default_view_offset() const {
@@ -395,7 +401,7 @@ private:
 };
 
 
-extern fgOPTIONS current_options;
+// extern FGOptions current_options;
 
 
 #endif /* _OPTIONS_HXX */
index 3c1741428d9f95dbb5173cf1091c3c709acb29ea..ef9aa039ebde78b7fa944e1420e7423bc039b068 100644 (file)
@@ -43,7 +43,6 @@
 #include <simgear/math/fg_random.h>
 #include <simgear/misc/fgpath.hxx>
 
-#include <Main/options.hxx>
 #include <Objects/texload.h>
 
 #include "globals.hxx"
@@ -79,7 +78,7 @@ void fgSplashInit ( void ) {
     char num_str[256];
     sprintf(num_str, "%d", num);
 
-    FGPath tpath( current_options.get_fg_root() );
+    FGPath tpath( globals->get_options()->get_fg_root() );
     tpath.append( "Textures/Splash" );
     tpath.concat( num_str );
     tpath.concat( ".rgb" );
index 43da10faa382f393a83287399d3f341bdb73664c..6bf8f45054f3468f4a31e385ee061f0ade6e2982 100644 (file)
@@ -83,11 +83,11 @@ inline static void fgMakeViewRot( sgMat4 dst, const sgMat4 m1, const sgMat4 m2 )
 void FGViewer::Init( void ) {
     FG_LOG( FG_VIEW, FG_INFO, "Initializing View parameters" );
 
-    view_offset = goal_view_offset = current_options.get_default_view_offset();
+    view_offset = goal_view_offset = globals->get_options()->get_default_view_offset();
     sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 );
 
-    winWidth = current_options.get_xsize();
-    winHeight = current_options.get_ysize();
+    winWidth = globals->get_options()->get_xsize();
+    winHeight = globals->get_options()->get_ysize();
 
     set_win_ratio( winHeight / winWidth );
 
@@ -189,8 +189,8 @@ void FGViewer::UpdateViewMath( const FGInterface& f ) {
     sgMat4 VIEWo, TMP;
 
     if ( update_fov ) {
-       ssgSetFOV( current_options.get_fov(), 
-                  current_options.get_fov() * win_ratio );
+       ssgSetFOV( globals->get_options()->get_fov(), 
+                  globals->get_options()->get_fov() * win_ratio );
        update_fov = false;
     }
                
index b42d4bb801613230876cd70f8d675e36da462a9b..334ecb68c778e3e4f8fda3507bb5004285b742e6 100644 (file)
@@ -152,7 +152,7 @@ public:
     void UpdateViewMath( const FGInterface& f );
 
     // Update the field of view coefficients
-    void UpdateFOV( const fgOPTIONS& o );
+    void UpdateFOV( const FGOptions *o );
 
     // Transform a vector from world coordinates to the local plane
     void CurrentNormalInLocalPlane(sgVec3 dst, sgVec3 src);
index 6e9ca43e12659f687ec17ec3b8eac57fb6a3b38e..f03593b0ea0e5e0a5a9cbb184a0181e99c16a0b4 100644 (file)
@@ -61,10 +61,11 @@ extern "C" {
 #endif
 */
 
-#include <Main/options.hxx>
 #include <plib/sg.h>
 #include <plib/ssg.h>
 
+#include <Main/globals.hxx>
+
 int  net_blast_toggle, net_hud_display, net_is_registered;
 char *net_callsign, *FGFS_host;
 sgMat4 sgFGD_VIEW;
@@ -79,7 +80,7 @@ char *fg_net_init( ssgRoot *orig_scene ){
  // We enable display of netinfos only if user wishes it via cmd-line param
  net_hud_display = (net_hud_display == 0) ? 0 : 1; 
  // Get pilot's name from options, can be modified at runtime via menu
- net_callsign = (char *) current_options.get_net_id().c_str();
+ net_callsign = (char *) globals->get_options()->get_net_id().c_str();
  // Disable Blast Mode -1 = Disable, 0 = Enable  
  net_blast_toggle = -1;
  // We start unregistered, we reg. later via menu to fgd 
index 0597f1eeeeabb709d5f34eba76ead2722cd5fb42..104d32c160c29ed0953c4695e32c968b1e8f5f52 100644 (file)
@@ -46,7 +46,7 @@
 #include <simgear/misc/fgstream.hxx>
 
 #include <Include/general.hxx>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
 #include <Scenery/tileentry.hxx>
 
 #include "matlib.hxx"
@@ -118,14 +118,14 @@ bool FGMaterialLib::load( const string& mpath ) {
            in >> m;
 
            // build the ssgSimpleState
-           FGPath tex_path( current_options.get_fg_root() );
+           FGPath tex_path( globals->get_options()->get_fg_root() );
            tex_path.append( "Textures.high" );
 
            FGPath tmp_path = tex_path;
            tmp_path.append( m.get_texture_name() );
            if ( ! local_file_exists(tmp_path.str())
                 || general.get_glMaxTexSize() < 512 ) {
-               tex_path = FGPath( current_options.get_fg_root() );
+               tex_path = FGPath( globals->get_options()->get_fg_root() );
                tex_path.append( "Textures" );
            }
            
@@ -133,14 +133,14 @@ bool FGMaterialLib::load( const string& mpath ) {
                    << material_name << " (" << tex_path.c_str() << ")");
 
            GLenum shade_model = GL_SMOOTH;
-           if ( current_options.get_shading() == 1 ) {
+           if ( globals->get_options()->get_shading() == 1 ) {
                shade_model = GL_SMOOTH;
            } else {
                shade_model = GL_FLAT;
            }
 
            m.build_ssg_state( tex_path.str(), shade_model,
-                              current_options.get_textures() );
+                              globals->get_options()->get_textures() );
 
 #if EXTRA_DEBUG
            m.dump_info();
@@ -182,13 +182,14 @@ bool FGMaterialLib::add_item ( const string &mat_name, const string &full_path )
 #endif
 
     GLenum shade_model = GL_SMOOTH;
-    if ( current_options.get_shading() == 1 ) {
+    if ( globals->get_options()->get_shading() == 1 ) {
        shade_model = GL_SMOOTH;
     } else {
        shade_model = GL_FLAT;
     }
 
-    m.build_ssg_state( tex_path, shade_model, current_options.get_textures() );
+    m.build_ssg_state( tex_path, shade_model,
+                      globals->get_options()->get_textures() );
 
     material_lib.matlib[mat_name] = m;
 
index 74c7e2f99c530edabaee52851beeaefe513a7191..2d94dab7e00e874c02337d37bc7d07490c1980ec 100644 (file)
@@ -54,7 +54,7 @@
 #include <simgear/misc/stopwatch.hxx>
 #include <simgear/misc/texcoord.hxx>
 
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
 #include <Scenery/tileentry.hxx>
 
 #include "matlib.hxx"
@@ -259,7 +259,7 @@ ssgBranch *fgGenTile( const string& path, FGTileEntry *t) {
     leaf->setState( state );
 
     tile->addKid( leaf );
-    // if ( current_options.get_clouds() ) {
+    // if ( globals->get_options()->get_clouds() ) {
     //    fgGenCloudTile(path, t, tile);
     // }
 
@@ -309,7 +309,7 @@ ssgBranch *fgObjLoad( const string& path, FGTileEntry *t, const bool is_base) {
        return fgGenTile( path, t );
     }
 
-    shading = current_options.get_shading();
+    shading = globals->get_options()->get_shading();
 
     if ( is_base ) {
        t->ncount = 0;
@@ -691,7 +691,7 @@ ssgBranch *fgObjLoad( const string& path, FGTileEntry *t, const bool is_base) {
            << stopwatch.elapsedSeconds() << " seconds" );
 
     // Generate a cloud layer above the tiles
-    // if ( current_options.get_clouds() ) {
+    // if ( globals->get_options()->get_clouds() ) {
     //         fgGenCloudTile(path, t, tile);
     // }
     return tile;
index fb182fb5db23513d714c00fb52624bbb3fe9471b..b801ec49af33b36681d904af03ef228e2ffecfa5 100644 (file)
@@ -40,7 +40,6 @@
 #include <simgear/misc/fgpath.hxx>
 
 #include <Main/globals.hxx>
-#include <Main/options.hxx>
 #include <Objects/obj.hxx>
 #include <Scenery/scenery.hxx>  // for scenery.center
 
@@ -77,7 +76,7 @@ FGTileCache::init( void )
     // 
     //   target_cache_size >= (current.options.tile_diameter + 1) ** 2 
     // 
-    int side = current_options.get_tile_diameter() + 2;
+    int side = globals->get_options()->get_tile_diameter() + 2;
     int target_cache_size = (side*side);
     FG_LOG( FG_TERRAIN, FG_DEBUG, "  target cache size = " 
            << target_cache_size );
@@ -170,10 +169,10 @@ FGTileCache::fill_in( int index, const FGBucket& p )
     tile_cache[index].tile_bucket = p;
 
     FGPath tile_path;
-    if ( current_options.get_fg_scenery() != "" ) {
-       tile_path.set( current_options.get_fg_scenery() );
+    if ( globals->get_options()->get_fg_scenery() != "" ) {
+       tile_path.set( globals->get_options()->get_fg_scenery() );
     } else {
-       tile_path.set( current_options.get_fg_root() );
+       tile_path.set( globals->get_options()->get_fg_root() );
        tile_path.append( "Scenery" );
     }
     tile_path.append( p.gen_base_path() );
index b8c199fa07acab93fd58d9440d840f3ad815491b..6b148a629394b201cff5ead1e0af6851c8f10859 100644 (file)
@@ -41,7 +41,6 @@
 
 // #include <Aircraft/aircraft.hxx>
 #include <Main/globals.hxx>
-#include <Main/options.hxx>
 #include <Objects/obj.hxx>
 
 #ifndef FG_OLD_WEATHER
@@ -100,7 +99,7 @@ int FGTileMgr::init( void ) {
 
     state = Inited;
 
-    tile_diameter = current_options.get_tile_diameter();
+    tile_diameter = globals->get_options()->get_tile_diameter();
     FG_LOG( FG_TERRAIN, FG_INFO, "Tile Diameter = " << tile_diameter);
     
     previous_bucket.make_bad();
index de37b91490d207586b6445bda016b20d8e5ae6f8..6bdb51c1a574eb8907d08b97b221c9c66ca48f51 100644 (file)
@@ -56,7 +56,6 @@ FG_USING_STD(string);
 
 #include <Aircraft/aircraft.hxx>
 #include <Main/globals.hxx>
-#include <Main/options.hxx>
 
 #include "light.hxx"
 #include "sunpos.hxx"
@@ -76,7 +75,7 @@ void fgLIGHT::Init( void ) {
            "Initializing Lighting interpolation tables." );
 
     // build the path name to the ambient lookup table
-    FGPath path( current_options.get_fg_root() );
+    FGPath path( globals->get_options()->get_fg_root() );
     FGPath ambient = path;
     ambient.append( "Lighting/ambient" );
     FGPath diffuse = path;
index c8e47b4132c507f2bacf90595e4e94b0993bfea6..f149f0a58b28d693bce70a8102dd65f458f3721d 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <FDM/flight.hxx>
 #include <Main/globals.hxx>
-#include <Main/options.hxx>
 
 #include "light.hxx"
 #include "moonpos.hxx"
@@ -40,7 +39,7 @@
 
 // periodic time updater wrapper
 void fgUpdateLocalTime() {
-    FGPath zone( current_options.get_fg_root() );
+    FGPath zone( globals->get_options()->get_fg_root() );
     zone.append( "Timezone" );
 
     globals->get_time_params()->updateLocal( cur_fdm_state->get_Longitude(),