#include <Airports/runways.hxx>
#include <simgear/misc/sg_path.hxx>
-#include <WeatherCM/FGLocalWeatherDatabase.h>
+#ifdef FG_WEATHERCM
+# include <WeatherCM/FGLocalWeatherDatabase.h>
+#else
+# include <Environment/environment_mgr.hxx>
+# include <Environment/environment.hxx>
+#endif
//Constructor
FGApproach::FGApproach(){
// ============================================================================
void FGApproach::get_active_runway() {
+#ifdef FG_WEATHERCM
sgVec3 position = { lat, lon, elev };
-
-#ifndef FG_NEW_ENVIRONMENT
FGPhysicalProperty stationweather = WeatherDatabase->get(position);
+#else
+ FGEnvironment stationweather =
+ globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
#endif
SGPath path( globals->get_fg_root() );
FGRunways runways( path.c_str() );
//Set the heading to into the wind
-#ifndef FG_NEW_ENVIRONMENT
+#ifdef FG_WEATHERCM
double wind_x = stationweather.Wind[0];
double wind_y = stationweather.Wind[1];
-#else
- double wind_x = 0;
- double wind_y = 0; // FIXME
-#endif
double speed = sqrt( wind_x*wind_x + wind_y*wind_y ) * SG_METER_TO_NM / (60.0*60.0);
double hdg;
if (hdg < 0.0)
hdg += 360.0;
}
+#else
+ double hdg = stationweather.get_wind_from_heading_deg();
+#endif
FGRunway runway;
if ( runways.search( ident, int(hdg), &runway) ) {