Mask error message 'Failed to find runway 28R at ...' when no runway is requested in the command line
This commit is contained in:
parent
dcc77f1a7c
commit
35a8d66415
2 changed files with 13 additions and 4 deletions
|
@ -765,7 +765,7 @@ static bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
||||||
|
|
||||||
|
|
||||||
// Set current_options lon/lat given an airport id and runway number
|
// 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;
|
FGRunway r;
|
||||||
|
|
||||||
if ( id.length() ) {
|
if ( id.length() ) {
|
||||||
|
@ -776,7 +776,7 @@ static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy ) {
|
||||||
<< id << ":" << rwy );
|
<< id << ":" << rwy );
|
||||||
|
|
||||||
if ( ! globals->get_runways()->search( id, rwy, &r ) ) {
|
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 <<
|
"Failed to find runway " << rwy <<
|
||||||
" at airport " << id );
|
" at airport " << id );
|
||||||
return false;
|
return false;
|
||||||
|
@ -1123,6 +1123,7 @@ bool fgInitPosition() {
|
||||||
|
|
||||||
string apt = fgGetString("/sim/presets/airport-id");
|
string apt = fgGetString("/sim/presets/airport-id");
|
||||||
string rwy_no = fgGetString("/sim/presets/runway");
|
string rwy_no = fgGetString("/sim/presets/runway");
|
||||||
|
bool rwy_req = fgGetBool("/sim/presets/runway-requested");
|
||||||
double hdg = fgGetDouble("/sim/presets/heading-deg");
|
double hdg = fgGetDouble("/sim/presets/heading-deg");
|
||||||
string vor = fgGetString("/sim/presets/vor-id");
|
string vor = fgGetString("/sim/presets/vor-id");
|
||||||
double vor_freq = fgGetDouble("/sim/presets/vor-freq");
|
double vor_freq = fgGetDouble("/sim/presets/vor-freq");
|
||||||
|
@ -1137,7 +1138,7 @@ bool fgInitPosition() {
|
||||||
|
|
||||||
if ( !set_pos && !apt.empty() && !rwy_no.empty() ) {
|
if ( !set_pos && !apt.empty() && !rwy_no.empty() ) {
|
||||||
// An airport + runway is requested
|
// 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
|
// set tower position (a little off the heading for single
|
||||||
// runway airports)
|
// runway airports)
|
||||||
fgSetString("/sim/tower/airport-id", apt.c_str());
|
fgSetString("/sim/tower/airport-id", apt.c_str());
|
||||||
|
|
|
@ -1183,6 +1183,14 @@ fgOptScenario( const char *arg )
|
||||||
return FG_OPTIONS_OK;
|
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;
|
static map<string,size_t> fgOptionMap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1260,7 +1268,7 @@ struct OptionDesc {
|
||||||
{"enable-sound", false, OPTION_BOOL, "/sim/sound/pause", false, "", 0 },
|
{"enable-sound", false, OPTION_BOOL, "/sim/sound/pause", false, "", 0 },
|
||||||
{"airport", true, OPTION_STRING, "/sim/presets/airport-id", false, "", 0 },
|
{"airport", true, OPTION_STRING, "/sim/presets/airport-id", false, "", 0 },
|
||||||
{"airport-id", 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 },
|
{"vor", true, OPTION_FUNC, "", false, "", fgOptVOR },
|
||||||
{"ndb", true, OPTION_FUNC, "", false, "", fgOptNDB },
|
{"ndb", true, OPTION_FUNC, "", false, "", fgOptNDB },
|
||||||
{"carrier", true, OPTION_FUNC, "", false, "", fgOptCarrier },
|
{"carrier", true, OPTION_FUNC, "", false, "", fgOptCarrier },
|
||||||
|
|
Loading…
Add table
Reference in a new issue