1
0
Fork 0

- 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:
mfranz 2007-10-04 17:13:41 +00:00
parent d20db83c86
commit 7c3f46e82f

View file

@ -752,9 +752,10 @@ void fgInitTowerLocationListener() {
static bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) { static bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
FGRunway r; FGRunway r;
if ( id.length() ) { if ( id.empty() )
// set initial position from runway and heading return false;
// set initial position from runway and heading
SG_LOG( SG_GENERAL, SG_INFO, SG_LOG( SG_GENERAL, SG_INFO,
"Attempting to set starting position from airport code " "Attempting to set starting position from airport code "
<< id << " heading " << tgt_hdg ); << id << " heading " << tgt_hdg );
@ -764,9 +765,7 @@ static bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
"Failed to find a good runway for " << id << '\n' ); "Failed to find a good runway for " << id << '\n' );
return false; return false;
} }
} else { fgSetString("/sim/atc/runway", r._rwy_no.c_str());
return false;
}
double lat2, lon2, az2; double lat2, lon2, az2;
double heading = r._heading; double heading = r._heading;
@ -821,9 +820,10 @@ static bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy, bool rwy_req ) { static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy, bool rwy_req ) {
FGRunway r; FGRunway r;
if ( id.length() ) { if ( id.empty() )
// set initial position from airport and runway number return false;
// set initial position from airport and runway number
SG_LOG( SG_GENERAL, SG_INFO, SG_LOG( SG_GENERAL, SG_INFO,
"Attempting to set starting position for " "Attempting to set starting position for "
<< id << ":" << rwy ); << id << ":" << rwy );
@ -834,9 +834,7 @@ static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy, bo
" at airport " << id << ". Using default runway." ); " at airport " << id << ". Using default runway." );
return false; return false;
} }
} else { fgSetString("/sim/atc/runway", r._rwy_no.c_str());
return false;
}
double lat2, lon2, az2; double lat2, lon2, az2;
double heading = r._heading; double heading = r._heading;
@ -1196,7 +1194,8 @@ bool fgInitPosition() {
string parkpos = fgGetString("/sim/presets/parkpos"); string parkpos = fgGetString("/sim/presets/parkpos");
string fix = fgGetString("/sim/presets/fix"); 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() ) { if ( !set_pos && !apt.empty() && !rwy_no.empty() ) {
// An airport + runway is requested // An airport + runway is requested
@ -1257,6 +1256,8 @@ bool fgInitPosition() {
fgGetDouble("/sim/presets/longitude-deg") ); fgGetDouble("/sim/presets/longitude-deg") );
fgSetDouble( "/position/latitude-deg", fgSetDouble( "/position/latitude-deg",
fgGetDouble("/sim/presets/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 // 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()) { if ((fabs(gs) > 0.01 || fabs(od) > 0.1 || alt > 0.1) && carrier.empty()) {