+
+
+ fgSetDouble( "/environment/gravitational-acceleration-mps2",
+ Environment::Gravity::instance()->getGravity(SGGeod::fromDegFt(
+ _longitude_n->getDoubleValue(),
+ _latitude_n->getDoubleValue(),
+ _altitude_n->getDoubleValue()
+ )));
+}
+
+void
+FGEnvironmentMgr::updateClosestAirport()
+{
+ SG_LOG(SG_ENVIRONMENT, SG_DEBUG, "FGEnvironmentMgr::update: updating closest airport");
+
+ SGGeod pos = globals->get_aircraft_position();
+ FGAirport * nearestAirport = FGAirport::findClosest(pos, 100.0);
+ if( nearestAirport == NULL )
+ {
+ SG_LOG(SG_ENVIRONMENT,SG_WARN,"FGEnvironmentMgr::update: No airport within 100NM range");
+ }
+ else
+ {
+ 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());
+ }
+ }
+