1
0
Fork 0

Regularized the position initialization:

1. If /position/longitude-deg and /position/latitude-deg are in range,
   use them.
2. Otherwise, if /sim/startup/airport-id is not empty, use it.
3. Otherwise, set the lon/lat to the middle of the KSFO field.

The default used to be Globe, AZ, but that doesn't make sense since we
don't distribute that scenery by default any more.

With this change, starting from a save file seems to work properly:

  fgfs myflight.sav
This commit is contained in:
david 2002-05-01 23:13:36 +00:00
parent 7a9e2aba71
commit ff6943bd09
2 changed files with 22 additions and 9 deletions

View file

@ -1451,14 +1451,27 @@ int mainLoop( int argc, char **argv ) {
// Set position relative to glide slope if requested
fgSetPosFromGlideSlope();
// set current_options lon/lat if an airport id is specified
// cout << "3. airport_id = " << fgGetString("/sim/startup/airport-id") << endl;
// If we have an explicit, in-range lon/lat, use it.
// If not, check for an airport-id and use that.
// If not, default to the middle of the KSFO field.
// The default values for lon/lat are deliberately out of range
// so that the airport-id can take effect; valid lon/lat will
// override airport-id, however.
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' ) {
// fgSetPosFromAirportID( fgGetString("/sim/startup/airport-id") );
fgSetPosFromAirportIDandHdg( fgGetString("/sim/startup/airport-id"),
fgGetDouble("/orientation/heading-deg") );
// set tower position (a little off the heading for single runway airports)
fgSetTowerPosFromAirportID( fgGetString("/sim/startup/airport-id"), fgGetDouble("orientation/heading") );
// set tower position (a little off the heading for single
// runway airports)
fgSetTowerPosFromAirportID( fgGetString("/sim/startup/airport-id"),
fgGetDouble("orientation/heading") );
} else {
// Default to middle of KSFO field
fgSetDouble("/position/longitude-deg", -122.374843);
fgSetDouble("/position/latitude-deg", 37.619002);
}
}
SGTime *t = fgInitTime();

View file

@ -115,9 +115,9 @@ fgSetDefaults ()
// Otherwise, default to Scenery being in $FG_ROOT/Scenery
globals->set_fg_scenery("");
}
// Position (Globe, AZ)
fgSetDouble("/position/longitude-deg", -110.6642444);
fgSetDouble("/position/latitude-deg", 33.3528917);
// Position (deliberately out of range)
fgSetDouble("/position/longitude-deg", 9999.0);
fgSetDouble("/position/latitude-deg", 9999.0);
fgSetDouble("/position/altitude-ft", -9999.0);
// Orientation