1
0
Fork 0

Support helipad names in the --runway startup option

also give better user feedback if runway/helipad ID is unknown
This commit is contained in:
Christian Schmitt 2014-02-14 19:25:37 +01:00
parent 7bc7197f6a
commit 9d995907db

View file

@ -35,6 +35,8 @@
#include <Airports/airport.hxx> #include <Airports/airport.hxx>
#include <Airports/dynamics.hxx> #include <Airports/dynamics.hxx>
#include <AIModel/AIManager.hxx> #include <AIModel/AIManager.hxx>
#include <GUI/MessageBox.hxx>
using std::endl; using std::endl;
using std::string; using std::string;
@ -269,19 +271,29 @@ static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy, bo
SG_LOG( SG_GENERAL, SG_ALERT, "Failed to find airport:" << id); SG_LOG( SG_GENERAL, SG_ALERT, "Failed to find airport:" << id);
return false; return false;
} }
if (!apt->hasRunwayWithIdent(rwy)) { if (apt->hasRunwayWithIdent(rwy)) {
SG_LOG( SG_GENERAL, rwy_req ? SG_ALERT : SG_INFO, FGRunway* r(apt->getRunwayByIdent(rwy));
"Failed to find runway " << rwy << fgSetString("/sim/atc/runway", r->ident().c_str());
" at airport " << id << ". Using default runway." ); SGGeod startPos = r->pointOnCenterline( fgGetDouble("/sim/airport/runways/start-offset-m", 5.0));
return false; fgApplyStartOffset(startPos, r->headingDeg());
return true;
} else if (apt->hasHelipadWithIdent(rwy)) {
FGHelipad* h(apt->getHelipadByIdent(rwy));
fgApplyStartOffset(h->geod(), h->headingDeg());
return true;
} }
FGRunway* r(apt->getRunwayByIdent(rwy)); if (rwy_req) {
fgSetString("/sim/atc/runway", r->ident().c_str()); flightgear::modalMessageBox("Runway not available", "Runway/helipad "
SGGeod startPos = r->pointOnCenterline( fgGetDouble("/sim/airport/runways/start-offset-m", 5.0)); + rwy + " not found at airport " + apt->getId()
fgApplyStartOffset(startPos, r->headingDeg()); + " - " + apt->getName() );
return true; } else {
SG_LOG( SG_GENERAL, SG_INFO,
"Failed to find runway/helipad " << rwy <<
" at airport " << id << ". Using default runway." );
}
return false;
} }