From: curt Date: Sat, 13 Jan 2001 22:06:39 +0000 (+0000) Subject: David Megginson writes: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=576432ec75ce0c8f860e5df503cab37e3b8d9024;p=flightgear.git David Megginson writes: FGOptions is history, and the modules are (starting) to use the property manager directly. Let me know if I left any files out. Inevitably, there will be some problems with broken options, etc., that I haven't found in my tests, but I'll try to fix them quickly. We also need to stress that the property names currently in use are not stable -- we need to reorganize them a bit for clarity. --- diff --git a/src/Autopilot/auto_gui.cxx b/src/Autopilot/auto_gui.cxx index 472fe94c1..8d77b8271 100644 --- a/src/Autopilot/auto_gui.cxx +++ b/src/Autopilot/auto_gui.cxx @@ -41,6 +41,7 @@ #include
#include
#include
+#include
#include #include "auto_gui.hxx" @@ -292,7 +293,7 @@ void NewAltitudeInit(void) float alt = cur_fdm_state->get_Altitude(); - if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_METERS) { + if ( fgGetString("/sim/startup/units") == "meters") { alt *= FEET_TO_METER; } @@ -594,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 ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) { + if ( fgGetString("/sim/startup/units") == "feet" ) { alt *= FEET_TO_METER; } } else { @@ -635,16 +636,16 @@ void TgtAptDialog_OK (puObject *) void TgtAptDialog_Reset(puObject *) { - // strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 ); - sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() ); + // strncpy( NewAirportId, fgGetString("/sim/startup/airport-id").c_str(), 16 ); + sprintf( NewTgtAirportId, "%s", fgGetString("/sim/startup/airport-id").c_str() ); TgtAptDialogInput->setValue ( NewTgtAirportId ); TgtAptDialogInput->setCursor( 0 ) ; } void AddWayPoint(puObject *cb) { - // strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 ); - sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() ); + // strncpy( NewAirportId, fgGetString("/sim/startup/airport-id").c_str(), 16 ); + sprintf( NewTgtAirportId, "%s", fgGetString("/sim/startup/airport-id").c_str() ); TgtAptDialogInput->setValue( NewTgtAirportId ); FG_PUSH_PUI_DIALOG( TgtAptDialog ); @@ -675,8 +676,8 @@ void ClearRoute(puObject *cb) void NewTgtAirportInit(void) { FG_LOG( FG_AUTOPILOT, FG_INFO, " enter NewTgtAirportInit()" ); - // fgAPset_tgt_airport_id( globals->get_options()->get_airport_id() ); - sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() ); + // fgAPset_tgt_airport_id( fgGetString("/sim/startup/airport-id") ); + sprintf( NewTgtAirportId, "%s", fgGetString("/sim/startup/airport-id").c_str() ); FG_LOG( FG_AUTOPILOT, FG_INFO, " NewTgtAirportId " << NewTgtAirportId ); // printf(" NewTgtAirportId %s\n", NewTgtAirportId); int len = 150 - puGetStringWidth( puGetDefaultLabelFont(), diff --git a/src/Autopilot/newauto.cxx b/src/Autopilot/newauto.cxx index e432ee094..196791aef 100644 --- a/src/Autopilot/newauto.cxx +++ b/src/Autopilot/newauto.cxx @@ -99,7 +99,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() - * globals->get_options()->get_speed_up();; + * fgGetInt("/sim/speed-up"); // FIXME: inefficient double kts = ft_s * FEET_TO_METER * 3600 * METER_TO_NM; return kts; @@ -267,7 +267,7 @@ void FGAutopilot::reset() { update_old_control_values(); - sprintf( NewTgtAirportId, "%s", globals->get_options()->get_airport_id().c_str() ); + sprintf( NewTgtAirportId, "%s", fgGetString("/sim/startup/airport-id").c_str() ); // TargetLatitude = FGBFI::getLatitude(); // TargetLongitude = FGBFI::getLongitude(); @@ -743,7 +743,7 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) { // lock at current altitude TargetAltitude = FGBFI::getAltitude() * FEET_TO_METER; - if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) { + if ( fgGetString("/sim/startup/units") == "feet" ) { MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET ); } else { MakeTargetAltitudeStr( TargetAltitude * METER_TO_FEET ); @@ -754,7 +754,7 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) { } else if ( altitude_mode == FG_ALTITUDE_TERRAIN ) { TargetAGL = FGBFI::getAGL() * FEET_TO_METER; - if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) { + if ( fgGetString("/sim/startup/units") == "feet" ) { MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET ); } else { MakeTargetAltitudeStr( TargetAGL * METER_TO_FEET ); @@ -820,7 +820,7 @@ void FGAutopilot::AltitudeSet( double new_altitude ) { // cout << "new altitude = " << new_altitude << endl; - if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) { + if ( fgGetString("/sim/startup/units") == "feet" ) { target_alt = new_altitude * FEET_TO_METER; } @@ -833,7 +833,7 @@ void FGAutopilot::AltitudeSet( double new_altitude ) { // cout << "TargetAltitude = " << TargetAltitude << endl; - if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) { + if ( fgGetString("/sim/startup/units") == "feet" ) { target_alt *= METER_TO_FEET; } // ApAltitudeDialogInput->setValue((float)target_alt); @@ -847,7 +847,7 @@ void FGAutopilot::AltitudeAdjust( double inc ) { double target_alt, target_agl; - if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) { + if ( fgGetString("/sim/startup/units") == "feet" ) { target_alt = TargetAltitude * METER_TO_FEET; target_agl = TargetAGL * METER_TO_FEET; } else { @@ -871,7 +871,7 @@ void FGAutopilot::AltitudeAdjust( double inc ) target_agl = ( int ) ( target_agl / inc ) * inc + inc; } - if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) { + if ( fgGetString("/sim/startup/units") == "feet" ) { target_alt *= FEET_TO_METER; target_agl *= FEET_TO_METER; } @@ -879,9 +879,9 @@ void FGAutopilot::AltitudeAdjust( double inc ) TargetAltitude = target_alt; TargetAGL = target_agl; - if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) + if ( fgGetString("/sim/startup/units") == "feet" ) target_alt *= METER_TO_FEET; - if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) + if ( fgGetString("/sim/startup/units") == "feet" ) target_agl *= METER_TO_FEET; if ( altitude_mode == FG_ALTITUDE_LOCK ) { diff --git a/src/Cockpit/cockpit.cxx b/src/Cockpit/cockpit.cxx index 76de6c0de..81f40ddb9 100644 --- a/src/Cockpit/cockpit.cxx +++ b/src/Cockpit/cockpit.cxx @@ -44,6 +44,7 @@ #include #include #include
+#include
#include #include