1
0
Fork 0

Allow airports system to function without an environment manager - useful in some tests I'm writing.

This commit is contained in:
jmt 2009-09-28 23:43:31 +00:00 committed by Tim Moore
parent 13ff5da4be
commit 4ec0d64c50

View file

@ -250,13 +250,17 @@ FGRunway* FGAirport::getActiveRunwayForUsage() const
envMgr = (FGEnvironmentMgr *) globals->get_subsystem("environment"); envMgr = (FGEnvironmentMgr *) globals->get_subsystem("environment");
} }
FGEnvironment stationWeather(envMgr->getEnvironment(mPosition)); // This forces West-facing rwys to be used in no-wind situations
// which is consistent with Flightgear's initial setup.
double hdg = 270;
double windSpeed = stationWeather.get_wind_speed_kt(); if (envMgr) {
double hdg = stationWeather.get_wind_from_heading_deg(); FGEnvironment stationWeather(envMgr->getEnvironment(mPosition));
if (windSpeed <= 0.0) {
hdg = 270; // This forces West-facing rwys to be used in no-wind situations double windSpeed = stationWeather.get_wind_speed_kt();
// which is consistent with Flightgear's initial setup. if (windSpeed > 0.0) {
hdg = stationWeather.get_wind_from_heading_deg();
}
} }
return findBestRunwayForHeading(hdg); return findBestRunwayForHeading(hdg);