- // update closest airport information
- _positionTimeToLive = 30.0;
-
- SG_LOG(SG_ALL, SG_INFO, "FGEnvironmentMgr::update: updating closest airport");
-
- SGGeod pos = SGGeod::fromDeg(_longitude_n->getDoubleValue(),
- _latitude_n->getDoubleValue());
-
- FGAirport * nearestAirport = FGAirport::findClosest(pos, 100.0);
- if( nearestAirport == NULL )
- {
- SG_LOG(SG_ALL,SG_WARN,"FGEnvironmentMgr::update: No airport within 100NM range");
- }
- else
- {
- const string currentId = fgGetString("/sim/airport/closest-airport-id", "");
- if (currentId != nearestAirport->ident())
- {
- fgSetString("/sim/airport/closest-airport-id",
- nearestAirport->ident().c_str());
- }
- }
+ const string currentId = fgGetString("/sim/airport/closest-airport-id", "");
+ if (currentId != nearestAirport->ident())
+ {
+ SG_LOG(SG_ENVIRONMENT, SG_INFO, "FGEnvironmentMgr::updateClosestAirport: selected:" << nearestAirport->ident());
+ fgSetString("/sim/airport/closest-airport-id",
+ nearestAirport->ident().c_str());
+ }