1
0
Fork 0

Mask error message 'Failed to find runway 28R at ...' when no runway is requested in the command line

This commit is contained in:
fredb 2006-05-31 07:20:10 +00:00
parent dcc77f1a7c
commit 35a8d66415
2 changed files with 13 additions and 4 deletions

View file

@ -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
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() ) {
@ -776,7 +776,7 @@ static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy ) {
<< 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;
@ -1123,6 +1123,7 @@ bool fgInitPosition() {
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");
@ -1137,7 +1138,7 @@ bool fgInitPosition() {
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());

View file

@ -1183,6 +1183,14 @@ fgOptScenario( const char *arg )
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;
/*
@ -1260,7 +1268,7 @@ struct OptionDesc {
{"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 },