// 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 ( fgGetString("/sim/startup/airport-id")[0] != '\0' ) {
- // fgSetPosFromAirportID( fgGetString("/sim/startup/airport-id") );
+ // 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' ) {
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();
// 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