]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
Updated to support new weather subsystem (visibility variable determins
[flightgear.git] / src / Main / fg_init.cxx
index 23b2f9a39fa37b6957ceeb68b02983896d6cbdaa..646e18b2deb2518bb4e1802b8f7458e457a82464 100644 (file)
@@ -70,7 +70,8 @@
 #include <Time/light.hxx>
 #include <Time/sunpos.hxx>
 #include <Time/moonpos.hxx>
-#include <Weather/weather.hxx>
+// #include <Weather/weather.hxx>
+#include <WeatherCM/FGLocalWeatherDatabase.h>
 
 #include "fg_init.hxx"
 #include "options.hxx"
@@ -354,7 +355,7 @@ bool fgInitSubsystems( void ) {
     FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
     v->UpdateViewMath(f);
     FG_LOG( FG_GENERAL, FG_DEBUG, "  abs_view_pos = " << v->get_abs_view_pos());
-    v->UpdateWorldToEye(f);
+    // v->UpdateWorldToEye(f);
 
     // Build the solar system
     //fgSolarSystemInit(*t);
@@ -405,7 +406,21 @@ bool fgInitSubsystems( void ) {
                            fgEVENT::FG_EVENT_READY, 30000 );
 
     // Initialize the weather modeling subsystem
-    current_weather.Init();
+    // current_weather.Init();
+    // Initialize the WeatherDatabase
+    FG_LOG(FG_GENERAL, FG_INFO, "Creating LocalWeatherDatabase");
+    FGLocalWeatherDatabase::theFGLocalWeatherDatabase = 
+       new FGLocalWeatherDatabase(
+             Point3D( current_aircraft.fdm_state->get_Latitude(),
+                      current_aircraft.fdm_state->get_Longitude(),
+                      current_aircraft.fdm_state->get_Altitude() 
+                         * FEET_TO_METER) );
+
+    WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase;
+
+    // register the periodic update of the weather
+    global_events.Register( "weather update", fgUpdateWeatherDatabase,
+                           fgEVENT::FG_EVENT_READY, 30000);
 
     // Initialize the Cockpit subsystem
     if( fgCockpitInit( &current_aircraft )) {
@@ -537,7 +552,7 @@ void fgReInitSubsystems( void )
     FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
     v->UpdateViewMath(f);
     FG_LOG( FG_GENERAL, FG_DEBUG, "  abs_view_pos = " << v->get_abs_view_pos());
-    v->UpdateWorldToEye(f);
+    // v->UpdateWorldToEye(f);
 
     fgFDMInit( current_options.get_flight_model(), cur_fdm_state, 
               1.0 / DEFAULT_MODEL_HZ );