// Set current_options lon/lat given an airport id and runway number
-static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy ) {
+static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy, bool rwy_req ) {
FGRunway r;
if ( id.length() ) {
<< id << ":" << rwy );
if ( ! globals->get_runways()->search( id, rwy, &r ) ) {
- SG_LOG( SG_GENERAL, SG_ALERT,
+ SG_LOG( SG_GENERAL, rwy_req ? SG_ALERT : SG_INFO,
"Failed to find runway " << rwy <<
" at airport " << id );
return false;
string apt = fgGetString("/sim/presets/airport-id");
string rwy_no = fgGetString("/sim/presets/runway");
+ bool rwy_req = fgGetBool("/sim/presets/runway-requested");
double hdg = fgGetDouble("/sim/presets/heading-deg");
string vor = fgGetString("/sim/presets/vor-id");
double vor_freq = fgGetDouble("/sim/presets/vor-freq");
if ( !set_pos && !apt.empty() && !rwy_no.empty() ) {
// An airport + runway is requested
- if ( fgSetPosFromAirportIDandRwy( apt, rwy_no ) ) {
+ if ( fgSetPosFromAirportIDandRwy( apt, rwy_no, rwy_req ) ) {
// set tower position (a little off the heading for single
// runway airports)
fgSetString("/sim/tower/airport-id", apt.c_str());
return FG_OPTIONS_OK;
}
+static int
+fgOptRunway( const char *arg )
+{
+ fgSetString("/sim/presets/runway", arg );
+ fgSetBool("/sim/presets/runway-requested", true );
+ return FG_OPTIONS_OK;
+}
+
static map<string,size_t> fgOptionMap;
/*
{"enable-sound", false, OPTION_BOOL, "/sim/sound/pause", false, "", 0 },
{"airport", true, OPTION_STRING, "/sim/presets/airport-id", false, "", 0 },
{"airport-id", true, OPTION_STRING, "/sim/presets/airport-id", false, "", 0 },
- {"runway", true, OPTION_STRING, "/sim/presets/runway", false, "", 0 },
+ {"runway", true, OPTION_FUNC, "", false, "", fgOptRunway },
{"vor", true, OPTION_FUNC, "", false, "", fgOptVOR },
{"ndb", true, OPTION_FUNC, "", false, "", fgOptNDB },
{"carrier", true, OPTION_FUNC, "", false, "", fgOptCarrier },