]> git.mxchange.org Git - flightgear.git/commitdiff
Allow airports system to function without an environment manager - useful in some...
authorjmt <jmt>
Mon, 28 Sep 2009 23:43:31 +0000 (23:43 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 30 Sep 2009 06:14:39 +0000 (08:14 +0200)
src/Airports/simple.cxx

index bf6620f945fd9cf42d1abc2b8f170e8ea6d171ca..aa5af682576e3d352421ca9a7877a5251b85bfdb 100644 (file)
@@ -250,13 +250,17 @@ FGRunway* FGAirport::getActiveRunwayForUsage() const
     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();
-  double hdg = stationWeather.get_wind_from_heading_deg();
-  if (windSpeed <= 0.0) {
-    hdg = 270; // This forces West-facing rwys to be used in no-wind situations
-    // which is consistent with Flightgear's initial setup.
+  if (envMgr) {
+    FGEnvironment stationWeather(envMgr->getEnvironment(mPosition));
+  
+    double windSpeed = stationWeather.get_wind_speed_kt();
+    if (windSpeed > 0.0) {
+      hdg = stationWeather.get_wind_from_heading_deg();
+    }
   }
   
   return findBestRunwayForHeading(hdg);