]> git.mxchange.org Git - flightgear.git/commitdiff
Restructuring some of the initialization code.
authorcurt <curt>
Fri, 15 Nov 2002 21:13:29 +0000 (21:13 +0000)
committercurt <curt>
Fri, 15 Nov 2002 21:13:29 +0000 (21:13 +0000)
The general idea is to help clean up some aspects of the FDM init and be
able to provide startup conditions in a less ambiguous manner.

Previously, things like positions, orientations, and velocites were set on
"the bus".  These had to be read by the FDMs which then were supposed to
initialized themselves to those values and turn write around and start
modifying those values.  It was messy and cumbersome.

Now, all the initial fdm conditions are written to a sub-[property-]tree
under /sim/presets/

The values in /sim/presets/ always stay set to what the user has specified.
The user can change these at his/her liesure, and then request a "reset"
which will reset to the new conditions.  I don't even want to say how this
worked before. :-)

Now, an script, or gui interface can stage a set of initial conditions while
the sim is running (without disrupting it), and then call "reset" to commit
the change.

People who should worry about all this are FDM writters, and a small few
others who care about over all program structure and flow.

13 files changed:
src/Autopilot/auto_gui.cxx
src/Autopilot/newauto.cxx
src/FDM/Balloon.cxx
src/FDM/ExternalNet/ExternalNet.cxx
src/FDM/JSBSim/JSBSim.cxx
src/FDM/flight.cxx
src/GUI/apt_dlg.cxx
src/GUI/gui_local.cxx
src/Main/fg_init.cxx
src/Main/fg_props.cxx
src/Main/main.cxx
src/Main/options.cxx
src/Objects/newmat.cxx

index a91e531a3d9eca5240d33eed2c27d31c8358c8b5..4aca7092e27d7e1524ec39c712d0bb21bde84759 100644 (file)
@@ -664,7 +664,7 @@ void TgtAptDialog_OK (puObject *)
 
 void TgtAptDialog_Reset(puObject *)
 {
-    sprintf( NewTgtAirportId, "%s", fgGetString("/sim/startup/airport-id") );
+    sprintf( NewTgtAirportId, "%s", fgGetString("/sim/presets/airport-id") );
     TgtAptDialogInput->setValue ( NewTgtAirportId );
     TgtAptDialogInput->setCursor( 0 ) ;
 }
@@ -705,7 +705,7 @@ void TgtAptDialog_HandleArrow( puObject *arrow )
 
 void AddWayPoint(puObject *cb)
 {
-    sprintf( NewTgtAirportId, "%s", fgGetString("/sim/startup/airport-id") );
+    sprintf( NewTgtAirportId, "%s", fgGetString("/sim/presets/airport-id") );
     TgtAptDialogInput->setValue( NewTgtAirportId );
     
     /* refresh waypoint list */
@@ -776,7 +776,7 @@ void ClearRoute(puObject *cb)
 void NewTgtAirportInit()
 {
     SG_LOG( SG_AUTOPILOT, SG_INFO, " enter NewTgtAirportInit()" );
-    sprintf( NewTgtAirportId, "%s", fgGetString("/sim/startup/airport-id") );
+    sprintf( NewTgtAirportId, "%s", fgGetString("/sim/presets/airport-id") );
     SG_LOG( SG_AUTOPILOT, SG_INFO, " NewTgtAirportId " << NewTgtAirportId );
     
     TgtAptDialog = new puDialogBox (150, 350);
index 1e8414e2a901122c50773fa9e7268c68e68f90c9..da89b9a46bff8186e6955d60d411b9d003861e25 100644 (file)
@@ -396,7 +396,7 @@ void FGAutopilot::reset() {
        
     update_old_control_values();
 
-    sprintf( NewTgtAirportId, "%s", fgGetString("/sim/startup/airport-id") );
+    sprintf( NewTgtAirportId, "%s", fgGetString("/sim/presets/airport-id") );
        
     MakeTargetLatLonStr( get_TargetLatitude(), get_TargetLongitude() );
 }
index 1bd64a8716c22dc810b6b0f7ece714528705d2a3..90121c13ca60af40472d04c89c2cf2a4c62e4591 100644 (file)
@@ -103,9 +103,9 @@ void FGBalloonSim::init() {
 
     //set velocities
     sgSetVec3( temp,
-              fgGetDouble("/velocities/uBody-fps"),
-              fgGetDouble("/velocities/vBody-fps"),
-              fgGetDouble("/velocities/wBody-fps") );
+              fgGetDouble("/sim/presets/uBody-fps"),
+              fgGetDouble("/sim/presets/vBody-fps"),
+              fgGetDouble("/sim/presets/wBody-fps") );
     current_balloon.setVelocity( temp );
 
     SG_LOG( SG_FLIGHT, SG_INFO, "Finished initializing BalloonSim" );
index e2691f4f04a9fd4c246ad44e31be5b497a65dd9f..0b5825cb83ca966bc325ecb0d5b44509e921d58e 100644 (file)
@@ -393,12 +393,12 @@ void FGExternalNet::init() {
     // init method first.
     common_init();
 
-    double lon = fgGetDouble( "/position/longitude-deg" );
-    double lat = fgGetDouble( "/position/latitude-deg" );
-    double alt = fgGetDouble( "/position/altitude-ft" );
+    double lon = fgGetDouble( "/sim/presets/longitude-deg" );
+    double lat = fgGetDouble( "/sim/presets/latitude-deg" );
+    double alt = fgGetDouble( "/sim/presets/altitude-ft" );
     double ground = fgGetDouble( "/environment/ground-elevation-m" );
-    double heading = fgGetDouble("/orientation/heading-deg");
-    double speed = fgGetDouble( "/velocities/airspeed-kt" );
+    double heading = fgGetDouble("/sim/presets/heading-deg");
+    double speed = fgGetDouble( "/sim/presets/airspeed-kt" );
 
     char cmd[256];
 
@@ -435,7 +435,7 @@ void FGExternalNet::init() {
 
     SG_LOG( SG_IO, SG_INFO, "before sending reset command." );
 
-    if( fgGetBool("/sim/startup/onground") ) {
+    if( fgGetBool("/sim/presets/onground") ) {
       sprintf( cmd, "/reset?value=ground" );
     } else {
       sprintf( cmd, "/reset?value=air" );
index ffaf8543e1eb46c7a2581117b2eeb2ee5b1112e5..bbe5928918ca0b3a71d39855c4a187798a7fb52f 100644 (file)
@@ -141,7 +141,7 @@ FGJSBsim::FGJSBsim( double dt )
     fgSetDouble("/fdm/trim/aileron",    FCS->GetDaCmd());
     fgSetDouble("/fdm/trim/rudder",     FCS->GetDrCmd());
 
-    startup_trim = fgGetNode("/sim/startup/trim", true);
+    startup_trim = fgGetNode("/sim/presets/trim", true);
 
     trimmed = fgGetNode("/fdm/trim/trimmed", true);
     trimmed->setBoolValue(false);
@@ -751,7 +751,7 @@ void FGJSBsim::update_gear(void) {
 void FGJSBsim::do_trim(void) {
 
         FGTrim *fgtrim;
-        if( fgGetBool("/sim/startup/onground") ) {
+        if( fgGetBool("/sim/presets/onground") ) {
             fgic->SetVcalibratedKtsIC(0.0);
             fgtrim=new FGTrim(fdmex,tGround);
         } else {
index 4d0588702eceb948fbfdc5d11e15a6240dde1a93..c51e2b83ed84a5946c824cb3ad7d99d19d08c8a7 100644 (file)
@@ -195,19 +195,20 @@ FGInterface::common_init ()
 
     // Set initial position
     SG_LOG( SG_FLIGHT, SG_INFO, "...initializing position..." );
-    set_Longitude( fgGetDouble("/position/longitude-deg")
+    set_Longitude( fgGetDouble("/sim/presets/longitude-deg")
                    * SGD_DEGREES_TO_RADIANS );
-    set_Latitude( fgGetDouble("/position/latitude-deg")
+    set_Latitude( fgGetDouble("/sim/presets/latitude-deg")
                   * SGD_DEGREES_TO_RADIANS );
     double ground_elev_m = globals->get_scenery()->get_cur_elev();
     double ground_elev_ft = ground_elev_m * SG_METER_TO_FEET;
     _acmodel->get3DModel()->getFGLocation()->set_cur_elev_m( ground_elev_m );
     _set_Runway_altitude ( ground_elev_ft );
-    if ( fgGetBool("/sim/startup/onground")
-         || fgGetDouble("/position/altitude-ft") < ground_elev_ft ) {
+    if ( fgGetBool("/sim/presets/onground")
+         || fgGetDouble("/sim/presets/altitude-ft") < ground_elev_ft ) {
+        fgSetDouble("/sim/presets/altitude-ft", ground_elev_ft);
         fgSetDouble("/position/altitude-ft", ground_elev_ft);
     }
-    set_Altitude( fgGetDouble("/position/altitude-ft") );
+    set_Altitude( fgGetDouble("/sim/presets/altitude-ft") );
 
     // Set ground elevation
     SG_LOG( SG_FLIGHT, SG_INFO,
@@ -217,39 +218,39 @@ FGInterface::common_init ()
     // Set sea-level radius
     SG_LOG( SG_FLIGHT, SG_INFO, "...initializing sea-level radius..." );
     SG_LOG( SG_FLIGHT, SG_INFO, " lat = "
-            << fgGetDouble("/position/latitude-deg")
-            << " alt = " << fgGetDouble("/position/altitude-ft") );
+            << fgGetDouble("/sim/presets/latitude-deg")
+            << " alt = " << fgGetDouble("/sim/presets/altitude-ft") );
     double sea_level_radius_meters;
     double lat_geoc;
-    sgGeodToGeoc( fgGetDouble("/position/latitude-deg")
+    sgGeodToGeoc( fgGetDouble("/sim/presets/latitude-deg")
                     * SGD_DEGREES_TO_RADIANS,
-                  fgGetDouble("/position/altitude-ft") * SG_FEET_TO_METER,
+                  fgGetDouble("/sim/presets/altitude-ft") * SG_FEET_TO_METER,
                   &sea_level_radius_meters, &lat_geoc );
     _set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET );
 
     // Set initial velocities
     SG_LOG( SG_FLIGHT, SG_INFO, "...initializing velocities..." );
-    if ( !fgHasNode("/sim/startup/speed-set") ) {
+    if ( !fgHasNode("/sim/presets/speed-set") ) {
         set_V_calibrated_kts(0.0);
     } else {
-        const string speedset = fgGetString("/sim/startup/speed-set");
+        const string speedset = fgGetString("/sim/presets/speed-set");
         if ( speedset == "knots" || speedset == "KNOTS" ) {
-            set_V_calibrated_kts( fgGetDouble("/velocities/airspeed-kt") );
+            set_V_calibrated_kts( fgGetDouble("/sim/presets/airspeed-kt") );
         } else if ( speedset == "mach" || speedset == "MACH" ) {
-            set_Mach_number( fgGetDouble("/velocities/mach") );
+            set_Mach_number( fgGetDouble("/sim/presets/mach") );
         } else if ( speedset == "UVW" || speedset == "uvw" ) {
             set_Velocities_Wind_Body(
-                                     fgGetDouble("/velocities/uBody-fps"),
-                                     fgGetDouble("/velocities/vBody-fps"),
-                                     fgGetDouble("/velocities/wBody-fps") );
+                                     fgGetDouble("/sim/presets/uBody-fps"),
+                                     fgGetDouble("/sim/presets/vBody-fps"),
+                                     fgGetDouble("/sim/presets/wBody-fps") );
         } else if ( speedset == "NED" || speedset == "ned" ) {
             set_Velocities_Local(
-                                 fgGetDouble("/velocities/speed-north-fps"),
-                                 fgGetDouble("/velocities/speed-east-fps"),
-                                 fgGetDouble("/velocities/speed-down-fps") );
+                                 fgGetDouble("/sim/presets/speed-north-fps"),
+                                 fgGetDouble("/sim/presets/speed-east-fps"),
+                                 fgGetDouble("/sim/presets/speed-down-fps") );
         } else {
             SG_LOG( SG_FLIGHT, SG_ALERT,
-                    "Unrecognized value for /sim/startup/speed-set: "
+                    "Unrecognized value for /sim/presets/speed-set: "
                     << speedset);
             set_V_calibrated_kts( 0.0 );
         }
@@ -257,11 +258,11 @@ FGInterface::common_init ()
 
     // Set initial Euler angles
     SG_LOG( SG_FLIGHT, SG_INFO, "...initializing Euler angles..." );
-    set_Euler_Angles( fgGetDouble("/orientation/roll-deg")
+    set_Euler_Angles( fgGetDouble("/sim/presets/roll-deg")
                         * SGD_DEGREES_TO_RADIANS,
-                      fgGetDouble("/orientation/pitch-deg")
+                      fgGetDouble("/sim/presets/pitch-deg")
                         * SGD_DEGREES_TO_RADIANS,
-                      fgGetDouble("/orientation/heading-deg")
+                      fgGetDouble("/sim/presets/heading-deg")
                         * SGD_DEGREES_TO_RADIANS );
 
     SG_LOG( SG_FLIGHT, SG_INFO, "End common FDM init" );
index 3399d7e914d710fd06a2a866958660c0a7396799..c45505545178e4368a04978365334ca8e3ffee42 100644 (file)
@@ -92,7 +92,7 @@ void AptDialog_OK (puObject *)
             cur_fdm_state->unbind();
         
             AptId = a.id.c_str();  /// NHV fix wrong case crash
-            fgSetString("/sim/startup/airport-id",  AptId.c_str() );
+            fgSetString("/sim/presets/airport-id",  AptId.c_str() );
             // fgSetDouble("/position/altitude-ft", -9999.0 );
             // fgSetPosFromAirportID( AptId );
             fgSetPosFromAirportIDandHdg( AptId, 
@@ -121,16 +121,16 @@ void AptDialog_OK (puObject *)
 
 void AptDialog_Reset(puObject *)
 {
-    //  strncpy( NewAirportId, fgGetString("/sim/startup/airport-id").c_str(), 16 );
-    sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id") );
+    //  strncpy( NewAirportId, fgGetString("/sim/presets/airport-id").c_str(), 16 );
+    sprintf( NewAirportId, "%s", fgGetString("/sim/presets/airport-id") );
     AptDialogInput->setValue ( NewAirportId );
     AptDialogInput->setCursor( 0 ) ;
 }
 
 void NewAirport(puObject *cb)
 {
-    //  strncpy( NewAirportId, fgGetString("/sim/startup/airport-id").c_str(), 16 );
-    sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id") );
+    //  strncpy( NewAirportId, fgGetString("/sim/presets/airport-id").c_str(), 16 );
+    sprintf( NewAirportId, "%s", fgGetString("/sim/presets/airport-id") );
     // cout << "NewAirport " << NewAirportId << endl;
     AptDialogInput->setValue( NewAirportId );
 
@@ -139,7 +139,7 @@ void NewAirport(puObject *cb)
 
 void NewAirportInit(void)
 {
-    sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id") );
+    sprintf( NewAirportId, "%s", fgGetString("/sim/presets/airport-id") );
     int len = 150
         - puGetDefaultLabelFont().getStringWidth( NewAirportLabel ) / 2;
 
index df6ac67e1272c653af7eb4c735dca0400a491ec5..329c823410f67eb049690de45a82ed2aa149e361 100644 (file)
@@ -76,7 +76,7 @@ void reInit(puObject *cb)
     // Unsuccessful KLUDGE to fix the 'every other time'
     // problem when doing a 'reset' after a 'goto airport'
        
-    // string AptId( fgGetString("/sim/startup/airport-id") );
+    // string AptId( fgGetString("/sim/presets/airport-id") );
     // if( AptId.c_str() != "\0" )
     //      fgSetPosFromAirportID( AptId );
        
index 22f9ee34f93e647cbb32ae849b9d9dd0e5632ce2..91c7d082d44a17b8c948eb97b6e1006b9460f976 100644 (file)
@@ -454,7 +454,7 @@ bool fgFindAirportID( const string& id, FGAirport *a ) {
 }
 
 
-// Set current_options lon/lat given an airport id
+// Preset lon/lat given an airport id
 bool fgSetPosFromAirportID( const string& id ) {
     FGAirport a;
     // double lon, lat;
@@ -463,12 +463,18 @@ bool fgSetPosFromAirportID( const string& id ) {
             "Attempting to set starting position from airport code " << id );
 
     if ( fgFindAirportID( id, &a ) ) {
-        fgSetDouble("/position/longitude-deg",  a.longitude );
-        fgSetDouble("/position/latitude-deg",  a.latitude );
+        // presets
+        fgSetDouble("/sim/presets/longitude-deg", a.longitude );
+        fgSetDouble("/sim/presets/latitude-deg", a.latitude );
+
+        // other code depends on the actual postition being set so set
+        // that as well
+        fgSetDouble("/position/longitude-deg", a.longitude );
+        fgSetDouble("/position/latitude-deg", a.latitude );
+
         SG_LOG( SG_GENERAL, SG_INFO,
-                "Position for " << id << " is ("
-                << a.longitude << ", "
-                << a.latitude << ")" );
+                "Position for " << id << " is (" << a.longitude
+                << ", " << a.latitude << ")" );
 
         return true;
     } else {
@@ -594,20 +600,26 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
                         azimuth, found_r.length * SG_FEET_TO_METER * 0.5 - 5.0,
                         &lat2, &lon2, &az2 );
 
-    if ( fabs( fgGetDouble("/sim/startup/offset-distance") ) > SG_EPSILON ) {
+    if ( fabs( fgGetDouble("/sim/presets/offset-distance") ) > SG_EPSILON ) {
         double olat, olon;
-        double odist = fgGetDouble("/sim/startup/offset-distance");
+        double odist = fgGetDouble("/sim/presets/offset-distance");
         odist *= SG_NM_TO_METER;
         double oaz = azimuth;
-        if ( fabs(fgGetDouble("/sim/startup/offset-azimuth")) > SG_EPSILON ) {
-            oaz = fgGetDouble("/sim/startup/offset-azimuth") + 180;
+        if ( fabs(fgGetDouble("/sim/presets/offset-azimuth")) > SG_EPSILON ) {
+            oaz = fgGetDouble("/sim/presets/offset-azimuth") + 180;
         }
         while ( oaz >= 360.0 ) { oaz -= 360.0; }
         geo_direct_wgs_84 ( 0, lat2, lon2, oaz, odist, &olat, &olon, &az2 );
         lat2=olat;
         lon2=olon;
     }
-        
+
+    // presets
+    fgSetDouble("/sim/presets/longitude-deg",  lon2 );
+    fgSetDouble("/sim/presets/latitude-deg",  lat2 );
+    fgSetDouble("/sim/presets/heading-deg", heading );
+
+    // other code depends on the actual values being set ...
     fgSetDouble("/position/longitude-deg",  lon2 );
     fgSetDouble("/position/latitude-deg",  lat2 );
     fgSetDouble("/orientation/heading-deg", heading );
@@ -624,21 +636,21 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
 
 void fgSetPosFromGlideSlope(void) {
     double gs = fgGetDouble("/velocities/glideslope");
-    double od = fgGetDouble("/sim/startup/offset-distance");
-    double alt = fgGetDouble("/position/altitude-ft");
+    double od = fgGetDouble("/sim/presets/offset-distance");
+    double alt = fgGetDouble("/sim/presets/altitude-ft");
     
     //if glideslope and offset-distance are set and altitude is
     //not, calculate the initial altitude
     if( fabs(gs) > 0.01 && fabs(od) > 0.1 && alt < -9990 ) {
         od *= SG_NM_TO_METER * SG_METER_TO_FEET;
         alt = fabs(od*tan(gs));
-        fgSetDouble("/position/altitude-ft",alt);
-        fgSetBool("/sim/startup/onground", false);
+        fgSetDouble("/sim/presets/altitude-ft",alt);
+        fgSetBool("/sim/presets/onground", false);
         SG_LOG(SG_GENERAL,SG_INFO, "Calculated altitude as: " << alt  << " ft");
     } else if( fabs(gs) > 0.01 && alt > 0 && fabs(od) < 0.1) {
         od  = alt/tan(gs);
         od *= -1*SG_FEET_TO_METER * SG_METER_TO_NM;
-        fgSetDouble("/sim/startup/offset-distance",od);
+        fgSetDouble("/sim/presets/offset-distance",od);
         SG_LOG(SG_GENERAL,SG_INFO, "Calculated offset distance as: " 
                                        << od  << " nm");
     } else if( fabs(gs) > 0.01 ) {
@@ -861,11 +873,11 @@ SGTime *fgInitTime() {
 // Returns non-zero if a problem encountered.
 bool fgInitSubsystems( void ) {
     static const SGPropertyNode *longitude
-        = fgGetNode("/position/longitude-deg");
+        = fgGetNode("/sim/presets/longitude-deg");
     static const SGPropertyNode *latitude
-        = fgGetNode("/position/latitude-deg");
+        = fgGetNode("/sim/presets/latitude-deg");
     static const SGPropertyNode *altitude
-        = fgGetNode("/position/altitude-ft");
+        = fgGetNode("/sim/presets/altitude-ft");
 
     fgLIGHT *l = &cur_light_params;
 
@@ -1277,11 +1289,11 @@ bool fgInitSubsystems( void ) {
 void fgReInitSubsystems( void )
 {
     static const SGPropertyNode *longitude
-        = fgGetNode("/position/longitude-deg");
+        = fgGetNode("/sim/presets/longitude-deg");
     static const SGPropertyNode *latitude
-        = fgGetNode("/position/latitude-deg");
+        = fgGetNode("/sim/presets/latitude-deg");
     static const SGPropertyNode *altitude
-        = fgGetNode("/position/altitude-ft");
+        = fgGetNode("/sim/presets/altitude-ft");
     static const SGPropertyNode *master_freeze
         = fgGetNode("/sim/freeze/master");
 
index 74a3a6578200cc7409e92deb7c11e07a5d8d7fa8..b84688aeb0b05438667680bca3dc697aed0ca523 100644 (file)
@@ -637,12 +637,12 @@ bool
 fgSaveFlight (ostream &output, bool write_all)
 {
 
-  fgSetBool("/sim/startup/onground", false);
-  fgSetArchivable("/sim/startup/onground");
-  fgSetBool("/sim/startup/trim", false);
-  fgSetArchivable("/sim/startup/trim");
-  fgSetString("/sim/startup/speed-set", "UVW");
-  fgSetArchivable("/sim/startup/speed-set");
+  fgSetBool("/sim/presets/onground", false);
+  fgSetArchivable("/sim/presets/onground");
+  fgSetBool("/sim/presets/trim", false);
+  fgSetArchivable("/sim/presets/trim");
+  fgSetString("/sim/presets/speed-set", "UVW");
+  fgSetArchivable("/sim/presets/speed-set");
 
   try {
     writeProperties(output, globals->get_props(), write_all);
@@ -668,9 +668,9 @@ fgLoadFlight (istream &input)
     return false;
   }
 
-  fgSetBool("/sim/startup/onground", false);
-  fgSetBool("/sim/startup/trim", false);
-  fgSetString("/sim/startup/speed-set", "UVW");
+  fgSetBool("/sim/presets/onground", false);
+  fgSetBool("/sim/presets/trim", false);
+  fgSetString("/sim/presets/speed-set", "UVW");
 
   copyProperties(&props, globals->get_props());
   // When loading a flight, make it the
index ca1474683a668fdda19083f51bc37d339b770d6a..915d95727fdd307fed409636a9e58461160f40e0 100644 (file)
@@ -1619,17 +1619,17 @@ int mainLoop( int argc, char **argv ) {
     double lon_deg = fgGetDouble("/position/longitude-deg");
     double lat_deg = fgGetDouble("/position/latitude-deg");
     if (lon_deg < -180 || lon_deg > 180 || lat_deg < -90 || lat_deg > 90) {
-      if ( fgGetString("/sim/startup/airport-id")[0] != '\0' ) {
-       fgSetPosFromAirportIDandHdg( fgGetString("/sim/startup/airport-id"),
-                                    fgGetDouble("/orientation/heading-deg") );
+      if ( fgGetString("/sim/presets/airport-id")[0] != '\0' ) {
+       fgSetPosFromAirportIDandHdg( fgGetString("/sim/presets/airport-id"),
+                                    fgGetDouble("/sim/presets/heading-deg") );
         // set tower position (a little off the heading for single 
        // runway airports)
-        fgSetTowerPosFromAirportID( fgGetString("/sim/startup/airport-id"),
-                                   fgGetDouble("orientation/heading") );
+        fgSetTowerPosFromAirportID( fgGetString("/sim/presets/airport-id"),
+                                   fgGetDouble("/sim/presets/heading-deg") );
       } else {
                                // Default to middle of KSFO field
-       fgSetDouble("/position/longitude-deg", -122.374843);
-       fgSetDouble("/position/latitude-deg", 37.619002);
+       fgSetDouble("/sim/presets/longitude-deg", -122.374843);
+       fgSetDouble("/sim/presets/latitude-deg", 37.619002);
       }
     }
 
index 24e3a191b276030b9c8f1875f8de1402772f0c97..feffe4c5bd9727378b63a18e7ded7e3571ef6460 100644 (file)
@@ -132,7 +132,6 @@ fgSetDefaults ()
     fgSetDouble("/orientation/pitch-deg", 0.424);
 
                                // Velocities
-    fgSetString("/sim/startup/speed-set", "knots");
     fgSetDouble("/velocities/uBody-fps", 0.0);
     fgSetDouble("/velocities/vBody-fps", 0.0);
     fgSetDouble("/velocities/wBody-fps", 0.0);
@@ -142,6 +141,28 @@ fgSetDefaults ()
     fgSetDouble("/velocities/airspeed-kt", 0.0);
     fgSetDouble("/velocities/mach", 0.0);
 
+                                // Presets
+    fgSetDouble("/sim/presets/longitude-deg", 9999.0);
+    fgSetDouble("/sim/presets/latitude-deg", 9999.0);
+    fgSetDouble("/sim/presets/altitude-ft", -9999.0);
+
+    fgSetDouble("/sim/presets/heading-deg", 270);
+    fgSetDouble("/sim/presets/roll-deg", 0);
+    fgSetDouble("/sim/presets/pitch-deg", 0.424);
+
+    fgSetString("/sim/presets/speed-set", "knots");
+    fgSetDouble("/sim/presets/airspeed-kt", 0.0);
+    fgSetDouble("/sim/presets/mach", 0.0);
+    fgSetDouble("/sim/presets/uBody-fps", 0.0);
+    fgSetDouble("/sim/presets/vBody-fps", 0.0);
+    fgSetDouble("/sim/presets/wBody-fps", 0.0);
+    fgSetDouble("/sim/presets/speed-north-fps", 0.0);
+    fgSetDouble("/sim/presets/speed-east-fps", 0.0);
+    fgSetDouble("/sim/presets/speed-down-fps", 0.0);
+
+    fgSetBool("/sim/presets/onground", true);
+    fgSetBool("/sim/presets/trim", false);
+
                                // Miscellaneous
     fgSetBool("/sim/startup/game-mode", false);
     fgSetBool("/sim/startup/splash-screen", true);
@@ -167,8 +188,6 @@ fgSetDefaults ()
     fgSetString("/sim/aero", "c172");
     fgSetInt("/sim/model-hz", NEW_DEFAULT_MODEL_HZ);
     fgSetInt("/sim/speed-up", 1);
-    fgSetBool("/sim/startup/trim", false);
-    fgSetBool("/sim/startup/onground", true);
 
                                // Rendering options
     fgSetString("/sim/rendering/fog", "nicest");
@@ -662,80 +681,82 @@ parse_option (const string& arg)
        fgSetBool("/sim/sound/audible", true);
     } else if ( arg.find( "--airport-id=") == 0 ) {
                                // NB: changed property name!!!
-       fgSetString("/sim/startup/airport-id", arg.substr(13).c_str());
+       fgSetString("/sim/presets/airport-id", arg.substr(13).c_str());
     } else if ( arg.find( "--offset-distance=") == 0 ) {
-       fgSetDouble("/sim/startup/offset-distance", atof(arg.substr(18)));
+       fgSetDouble("/sim/presets/offset-distance", atof(arg.substr(18)));
     } else if ( arg.find( "--offset-azimuth=") == 0 ) {
-       fgSetDouble("/sim/startup/offset-azimuth", atof(arg.substr(17))); 
+       fgSetDouble("/sim/presets/offset-azimuth", atof(arg.substr(17))); 
     } else if ( arg.find( "--lon=" ) == 0 ) {
-       fgSetDouble("/position/longitude-deg",
-                             parse_degree(arg.substr(6)));
-       fgSetString("/sim/startup/airport-id", "");
+       fgSetDouble("/sim/presets/longitude-deg", parse_degree(arg.substr(6)));
+       fgSetDouble("/position/longitude-deg", parse_degree(arg.substr(6)));
+       fgSetString("/sim/presets/airport-id", "");
     } else if ( arg.find( "--lat=" ) == 0 ) {
-       fgSetDouble("/position/latitude-deg",
-                             parse_degree(arg.substr(6)));
-       fgSetString("/sim/startup/airport-id", "");
+       fgSetDouble("/sim/presets/latitude-deg", parse_degree(arg.substr(6)));
+       fgSetDouble("/position/latitude-deg", parse_degree(arg.substr(6)));
+       fgSetString("/sim/presets/airport-id", "");
     } else if ( arg.find( "--altitude=" ) == 0 ) {
-       fgSetBool("/sim/startup/onground", false);
+       fgSetBool("/sim/presets/onground", false);
        if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
-           fgSetDouble("/position/altitude-ft", atof(arg.substr(11)));
+           fgSetDouble("/sim/presets/altitude-ft", atof(arg.substr(11)));
        else
-           fgSetDouble("/position/altitude-ft",
+           fgSetDouble("/sim/presets/altitude-ft",
                        atof(arg.substr(11)) * SG_METER_TO_FEET);
     } else if ( arg.find( "--uBody=" ) == 0 ) {
-        fgSetString("/sim/startup/speed-set", "UVW");
+        fgSetString("/sim/presets/speed-set", "UVW");
        if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
-         fgSetDouble("/velocities/uBody-fps", atof(arg.substr(8)));
+         fgSetDouble("/sim/presets/uBody-fps", atof(arg.substr(8)));
        else
-         fgSetDouble("/velocities/uBody-fps",
-                              atof(arg.substr(8)) * SG_METER_TO_FEET);
+         fgSetDouble("/sim/presets/uBody-fps",
+                      atof(arg.substr(8)) * SG_METER_TO_FEET);
     } else if ( arg.find( "--vBody=" ) == 0 ) {
-        fgSetString("/sim/startup/speed-set", "UVW");
+        fgSetString("/sim/presets/speed-set", "UVW");
        if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
-         fgSetDouble("/velocities/vBody-fps", atof(arg.substr(8)));
+         fgSetDouble("/sim/presets/vBody-fps", atof(arg.substr(8)));
        else
-         fgSetDouble("/velocities/vBody-fps",
+         fgSetDouble("/sim/presets/vBody-fps",
                               atof(arg.substr(8)) * SG_METER_TO_FEET);
     } else if ( arg.find( "--wBody=" ) == 0 ) {
-        fgSetString("/sim/startup/speed-set", "UVW");
+        fgSetString("/sim/presets/speed-set", "UVW");
        if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
-         fgSetDouble("/velocities/wBody-fps", atof(arg.substr(8)));
+         fgSetDouble("/sim/presets/wBody-fps", atof(arg.substr(8)));
        else
-         fgSetDouble("/velocities/wBody-fps",
+         fgSetDouble("/sim/presets/wBody-fps",
                               atof(arg.substr(8)) * SG_METER_TO_FEET);
     } else if ( arg.find( "--vNorth=" ) == 0 ) {
-        fgSetString("/sim/startup/speed-set", "NED");
+        fgSetString("/sim/presets/speed-set", "NED");
        if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
-         fgSetDouble("/velocities/speed-north-fps", atof(arg.substr(9)));
+         fgSetDouble("/sim/presets/speed-north-fps", atof(arg.substr(9)));
        else
-         fgSetDouble("/velocities/speed-north-fps",
+         fgSetDouble("/sim/presets/speed-north-fps",
                               atof(arg.substr(9)) * SG_METER_TO_FEET);
     } else if ( arg.find( "--vEast=" ) == 0 ) {
-        fgSetString("/sim/startup/speed-set", "NED");
+        fgSetString("/sim/presets/speed-set", "NED");
        if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
-         fgSetDouble("/velocities/speed-east-fps", atof(arg.substr(8)));
+         fgSetDouble("/sim/presets/speed-east-fps", atof(arg.substr(8)));
        else
-         fgSetDouble("/velocities/speed-east-fps",
+         fgSetDouble("/sim/presets/speed-east-fps",
                      atof(arg.substr(8)) * SG_METER_TO_FEET);
     } else if ( arg.find( "--vDown=" ) == 0 ) {
-        fgSetString("/sim/startup/speed-set", "NED");
+        fgSetString("/sim/presets/speed-set", "NED");
        if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
-         fgSetDouble("/velocities/speed-down-fps", atof(arg.substr(8)));
+         fgSetDouble("/sim/presets/speed-down-fps", atof(arg.substr(8)));
        else
-         fgSetDouble("/velocities/speed-down-fps",
+         fgSetDouble("/sim/presets/speed-down-fps",
                               atof(arg.substr(8)) * SG_METER_TO_FEET);
     } else if ( arg.find( "--vc=" ) == 0) {
-        fgSetString("/sim/startup/speed-set", "knots");
-       fgSetDouble("/velocities/airspeed-kt", atof(arg.substr(5)));
+        // fgSetString("/sim/presets/speed-set", "knots");
+       // fgSetDouble("/velocities/airspeed-kt", atof(arg.substr(5)));
+        fgSetString("/sim/presets/speed-set", "knots");
+       fgSetDouble("/sim/presets/airspeed-kt", atof(arg.substr(5)));
     } else if ( arg.find( "--mach=" ) == 0) {
-        fgSetString("/sim/startup/speed-set", "mach");
-       fgSetDouble("/velocities/mach", atof(arg.substr(7)));
+        fgSetString("/sim/presets/speed-set", "mach");
+       fgSetDouble("/sim/presets/mach", atof(arg.substr(7)));
     } else if ( arg.find( "--heading=" ) == 0 ) {
-       fgSetDouble("/orientation/heading-deg", atof(arg.substr(10)));
+       fgSetDouble("/sim/presets/heading-deg", atof(arg.substr(10)));
     } else if ( arg.find( "--roll=" ) == 0 ) {
-       fgSetDouble("/orientation/roll-deg", atof(arg.substr(7)));
+       fgSetDouble("/sim/presets/roll-deg", atof(arg.substr(7)));
     } else if ( arg.find( "--pitch=" ) == 0 ) {
-       fgSetDouble("/orientation/pitch-deg", atof(arg.substr(8)));
+       fgSetDouble("/sim/presets/pitch-deg", atof(arg.substr(8)));
     } else if ( arg.find( "--glideslope=" ) == 0 ) {
        fgSetDouble("/velocities/glideslope", atof(arg.substr(13))
                                           *SG_DEGREES_TO_RADIANS);
@@ -758,13 +779,13 @@ parse_option (const string& arg)
     } else if ( arg.find( "--speed=" ) == 0 ) {
        fgSetInt("/sim/speed-up", atoi(arg.substr(8)));
     } else if ( arg.find( "--trim") == 0) {
-        fgSetBool("/sim/startup/trim", true);
+        fgSetBool("/sim/presets/trim", true);
     } else if ( arg.find( "--notrim") == 0) {
-        fgSetBool("/sim/startup/trim", false);
+        fgSetBool("/sim/presets/trim", false);
     } else if ( arg.find( "--on-ground") == 0) {
-        fgSetBool("/sim/startup/onground", true);
+        fgSetBool("/sim/presets/onground", true);
     } else if ( arg.find( "--in-air") == 0) {
-        fgSetBool("/sim/startup/onground", false);
+        fgSetBool("/sim/presets/onground", false);
     } else if ( arg == "--fog-disable" ) {
        fgSetString("/sim/rendering/fog", "disabled");
     } else if ( arg == "--fog-fastest" ) {
@@ -1314,9 +1335,11 @@ void fgShowAircraft(void) {
              continue;
           }
 
-          SGPropertyNode *desc, *node = root.getNode("sim");
-          if (node)
+          SGPropertyNode *desc = NULL;
+          SGPropertyNode *node = root.getNode("sim");
+          if (node) {
              desc = node->getNode("description");
+          }
 
           char cstr[96];
           if (strlen(dire->d_name) <= 27)
index 04dee8a06f43f1af39eeb9e2f77cddabc2b57ae9..06a6d59f3fe9eb841aa4490d4d2db7db5fa836bf 100644 (file)
@@ -390,6 +390,7 @@ FGNewMat::build_ssg_state (bool defer_tex_load)
     textured->disable( GL_BLEND );
     textured->disable( GL_ALPHA_TEST );
     if ( !defer_tex_load ) {
+        SG_LOG(SG_INPUT, SG_INFO, "    " << texture_path );
        textured->setTexture( (char *)texture_path.c_str(), wrapu, wrapv );
        texture_loaded = true;
     } else {