SG_LOG( SG_GENERAL, SG_ALERT, "Failed to find airport " << id );
return false;
}
- FGAirportDynamics* dcs = apt->getDynamics();
+ FGAirportDynamicsRef dcs = apt->getDynamics();
if (!dcs) {
SG_LOG( SG_GENERAL, SG_ALERT,
"Airport " << id << "does not appear to have parking information available");
// The parking will be released after this function returns.
// As a temporary measure, I'll try to reserve the parking via the atc_manager, which should work, because it uses the same
// mechanism as the AI traffic code.
- dcs->setParkingAvailable(pka.parking()->guid(), false);
+ dcs->setParkingAvailable(pka.parking(), false);
fgApplyStartOffset(pka.parking()->geod(), pka.parking()->getHeading());
return true;
}
}
if ( !set_pos ) {
- // No lon/lat specified, no airport specified, default to
- // middle of KSFO field.
- fgSetDouble("/sim/presets/longitude-deg", -122.374843);
- fgSetDouble("/sim/presets/latitude-deg", 37.619002);
+ // No lon/lat specified, no airport specified, use the default airport
+ // TODO: don't hardcode this
+ const FGAirport* airport = fgFindAirportID("LEBL");
+ if( airport ) {
+ const SGGeod & airportGeod = airport->geod();
+ fgSetDouble("/sim/presets/longitude-deg", airportGeod.getLongitudeDeg());
+ fgSetDouble("/sim/presets/latitude-deg", airportGeod.getLatitudeDeg());
+ } else {
+ // So, the default airport is unknown? We are in serious trouble.
+ // Let's hope KSFO still exists somehow
+ fgSetDouble("/sim/presets/longitude-deg", -122.374843);
+ fgSetDouble("/sim/presets/latitude-deg", 37.619002);
+ SG_LOG(SG_GENERAL, SG_ALERT, "Sorry, the default airport seems to be unknown.");
+ }
}
fgSetDouble( "/position/longitude-deg",