]> 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 cecf5d65474d6431922898ed38e37b7b43f195f8..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"
@@ -314,7 +315,9 @@ bool fgInitSubsystems( void ) {
     // and should really be read in from one or more files.
 
     // Initial Velocity
-    f->set_Velocities_Local( 0.0, 0.0, 0.0 );
+    f->set_Velocities_Local( current_options.get_uBody(),
+                             current_options.get_vBody(),
+                             current_options.get_wBody());
 
     // Initial Orientation
     f->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
@@ -352,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);
@@ -403,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 )) {
@@ -508,7 +525,9 @@ void fgReInitSubsystems( void )
     // and should really be read in from one or more files.
 
     // Initial Velocity
-    f->set_Velocities_Local( 0.0, 0.0, 0.0 );
+    f->set_Velocities_Local( current_options.get_uBody(),
+                             current_options.get_vBody(),
+                             current_options.get_wBody());
 
     // Initial Orientation
     f->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
@@ -533,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 );