- if no heading preset was given (>=9999), use wind-from direction
- write chosen runway to /sim/atc/runway, so that ATC can give a hint - minor cleanup
This commit is contained in:
parent
d20db83c86
commit
7c3f46e82f
1 changed files with 26 additions and 25 deletions
|
@ -752,21 +752,20 @@ void fgInitTowerLocationListener() {
|
|||
static bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
||||
FGRunway r;
|
||||
|
||||
if ( id.length() ) {
|
||||
// set initial position from runway and heading
|
||||
if ( id.empty() )
|
||||
return false;
|
||||
|
||||
SG_LOG( SG_GENERAL, SG_INFO,
|
||||
"Attempting to set starting position from airport code "
|
||||
<< id << " heading " << tgt_hdg );
|
||||
// set initial position from runway and heading
|
||||
SG_LOG( SG_GENERAL, SG_INFO,
|
||||
"Attempting to set starting position from airport code "
|
||||
<< id << " heading " << tgt_hdg );
|
||||
|
||||
if ( ! globals->get_runways()->search( id, (int)tgt_hdg, &r ) ) {
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Failed to find a good runway for " << id << '\n' );
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ( ! globals->get_runways()->search( id, (int)tgt_hdg, &r ) ) {
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Failed to find a good runway for " << id << '\n' );
|
||||
return false;
|
||||
}
|
||||
fgSetString("/sim/atc/runway", r._rwy_no.c_str());
|
||||
|
||||
double lat2, lon2, az2;
|
||||
double heading = r._heading;
|
||||
|
@ -821,22 +820,21 @@ static bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
|
|||
static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy, bool rwy_req ) {
|
||||
FGRunway r;
|
||||
|
||||
if ( id.length() ) {
|
||||
// set initial position from airport and runway number
|
||||
if ( id.empty() )
|
||||
return false;
|
||||
|
||||
SG_LOG( SG_GENERAL, SG_INFO,
|
||||
"Attempting to set starting position for "
|
||||
<< id << ":" << rwy );
|
||||
// set initial position from airport and runway number
|
||||
SG_LOG( SG_GENERAL, SG_INFO,
|
||||
"Attempting to set starting position for "
|
||||
<< id << ":" << rwy );
|
||||
|
||||
if ( ! globals->get_runways()->search( id, rwy, &r ) ) {
|
||||
SG_LOG( SG_GENERAL, rwy_req ? SG_ALERT : SG_INFO,
|
||||
"Failed to find runway " << rwy <<
|
||||
" at airport " << id << ". Using default runway." );
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ( ! globals->get_runways()->search( id, rwy, &r ) ) {
|
||||
SG_LOG( SG_GENERAL, rwy_req ? SG_ALERT : SG_INFO,
|
||||
"Failed to find runway " << rwy <<
|
||||
" at airport " << id << ". Using default runway." );
|
||||
return false;
|
||||
}
|
||||
fgSetString("/sim/atc/runway", r._rwy_no.c_str());
|
||||
|
||||
double lat2, lon2, az2;
|
||||
double heading = r._heading;
|
||||
|
@ -1196,7 +1194,8 @@ bool fgInitPosition() {
|
|||
string parkpos = fgGetString("/sim/presets/parkpos");
|
||||
string fix = fgGetString("/sim/presets/fix");
|
||||
|
||||
fgSetDouble( "/orientation/heading-deg", hdg );
|
||||
if (hdg > 9990.0)
|
||||
hdg = fgGetDouble("/environment/config/boundary/entry/wind-from-heading-deg", 270);
|
||||
|
||||
if ( !set_pos && !apt.empty() && !rwy_no.empty() ) {
|
||||
// An airport + runway is requested
|
||||
|
@ -1257,6 +1256,8 @@ bool fgInitPosition() {
|
|||
fgGetDouble("/sim/presets/longitude-deg") );
|
||||
fgSetDouble( "/position/latitude-deg",
|
||||
fgGetDouble("/sim/presets/latitude-deg") );
|
||||
fgSetDouble( "/orientation/heading-deg",
|
||||
fgGetDouble("/sim/presets/heading-deg") );
|
||||
|
||||
// determine if this should be an on-ground or in-air start
|
||||
if ((fabs(gs) > 0.01 || fabs(od) > 0.1 || alt > 0.1) && carrier.empty()) {
|
||||
|
|
Loading…
Reference in a new issue