Tweaks to presets logic.
This commit is contained in:
parent
14c3e9e4d4
commit
b1bfd1aa27
1 changed files with 10 additions and 14 deletions
|
@ -1018,45 +1018,41 @@ bool fgInitPosition() {
|
||||||
string ndb = fgGetString("/sim/presets/ndb-id");
|
string ndb = fgGetString("/sim/presets/ndb-id");
|
||||||
double ndb_freq = fgGetDouble("/sim/presets/ndb-freq");
|
double ndb_freq = fgGetDouble("/sim/presets/ndb-freq");
|
||||||
string fix = fgGetString("/sim/presets/fix");
|
string fix = fgGetString("/sim/presets/fix");
|
||||||
|
|
||||||
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 ) ) {
|
||||||
// set position (a little off the heading for single
|
// set tower position (a little off the heading for single
|
||||||
// runway airports)
|
// runway airports)
|
||||||
fgSetTowerPosFromAirportID( apt, hdg );
|
fgSetTowerPosFromAirportID( apt, hdg );
|
||||||
|
|
||||||
set_pos = true;
|
set_pos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !set_pos && !apt.empty() ) {
|
if ( !set_pos && !apt.empty() ) {
|
||||||
// An airport is requested (find runway closest to hdg)
|
// An airport is requested (find runway closest to hdg)
|
||||||
bool ok = false;
|
if ( fgSetPosFromAirportIDandHdg( apt, hdg ) ) {
|
||||||
if (fgGetDouble("/sim/presets/altitude-ft") <= 0 &&
|
// set tower position (a little off the heading for single
|
||||||
fgGetDouble("/sim/presets/offset-distance") == 0)
|
|
||||||
ok = fgSetPosFromAirportIDandHdg( apt, hdg );
|
|
||||||
else
|
|
||||||
ok = fgSetPosFromAirportID( apt );
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
// set position (a little off the heading for single
|
|
||||||
// runway airports)
|
// runway airports)
|
||||||
fgSetTowerPosFromAirportID( apt, hdg );
|
fgSetTowerPosFromAirportID( apt, hdg );
|
||||||
|
|
||||||
set_pos = true;
|
set_pos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !set_pos && !vor.empty() ) {
|
if ( !set_pos && !vor.empty() ) {
|
||||||
// a VOR is requested
|
// a VOR is requested
|
||||||
if ( fgSetPosFromNAV( vor, vor_freq ) ) {
|
if ( fgSetPosFromNAV( vor, vor_freq ) ) {
|
||||||
set_pos = true;
|
set_pos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !set_pos && !ndb.empty() ) {
|
if ( !set_pos && !ndb.empty() ) {
|
||||||
// an NDB is requested
|
// an NDB is requested
|
||||||
if ( fgSetPosFromNAV( ndb, ndb_freq ) ) {
|
if ( fgSetPosFromNAV( ndb, ndb_freq ) ) {
|
||||||
set_pos = true;
|
set_pos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !set_pos && !fix.empty() ) {
|
if ( !set_pos && !fix.empty() ) {
|
||||||
// a Fix is requested
|
// a Fix is requested
|
||||||
if ( fgSetPosFromFix( fix ) ) {
|
if ( fgSetPosFromFix( fix ) ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue