]> git.mxchange.org Git - flightgear.git/commitdiff
Fixes to Christian's latest weather submission.
authorcurt <curt>
Thu, 21 Oct 1999 22:53:12 +0000 (22:53 +0000)
committercurt <curt>
Thu, 21 Oct 1999 22:53:12 +0000 (22:53 +0000)
src/Main/fg_init.cxx
src/WeatherCM/FGLocalWeatherDatabase.cpp
src/WeatherCM/FGLocalWeatherDatabase.h
src/WeatherCM/FGWeatherDefs.h

index 8d24d47d9a5ca41277eeee6d1fa2f381542f2c99..ac3916ed357122c9d850a632f23b122a82e4dee9 100644 (file)
@@ -233,7 +233,7 @@ bool fgInitSubsystems( void ) {
     } else if ( current_options.get_flight_model() == FGInterface::FG_JSBSIM ) {
        cur_fdm_state = new FGJSBsim;
     } else if ( current_options.get_flight_model() == 
-               FGInterface::FG_BALLOONSIM ) {
+               FGInterface::FG_BALLOONSIM ) {
        cur_fdm_state = new FGBalloonSim;
     } else if ( current_options.get_flight_model() == 
                FGInterface::FG_MAGICCARPET ) {
@@ -432,18 +432,21 @@ bool fgInitSubsystems( void ) {
 #ifndef FG_OLD_WEATHER
     // Initialize the WeatherDatabase
     FG_LOG(FG_GENERAL, FG_INFO, "Creating LocalWeatherDatabase");
+    sgVec3 position;
+    sgSetVec3( position, current_aircraft.fdm_state->get_Latitude(),
+              current_aircraft.fdm_state->get_Longitude(),
+              current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
     FGLocalWeatherDatabase::theFGLocalWeatherDatabase = 
-       new FGLocalWeatherDatabase(
-                      current_aircraft.fdm_state->get_Latitude(),
-                      current_aircraft.fdm_state->get_Longitude(),
-                      current_aircraft.fdm_state->get_Altitude() 
-                         * FEET_TO_METER );
+       new FGLocalWeatherDatabase( position );
+    // cout << theFGLocalWeatherDatabase << endl;
+    // cout << "visibility = " 
+    //      << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;
 
     WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase;
-
+     
     // register the periodic update of the weather
     global_events.Register( "weather update", fgUpdateWeatherDatabase,
-                           fgEVENT::FG_EVENT_READY, 30000);
+                            fgEVENT::FG_EVENT_READY, 30000);
 #else
     current_weather.Init();
 #endif
index f88e87b7e46e157d8a845d8fa0a2c469c545f4e8..6dd14c86bbac17e547a158453a2a438c5f3308f1 100644 (file)
@@ -93,7 +93,7 @@ void FGLocalWeatherDatabase::tileLocalWeather(const FGPhysicalProperties2DVector
 FGLocalWeatherDatabase* FGLocalWeatherDatabase::theFGLocalWeatherDatabase = 0;
 FGLocalWeatherDatabase *WeatherDatabase;
 
-FGLocalWeatherDatabase::FGLocalWeatherDatabase(const sgVec3& posititon, const WeatherPrecision visibility, const DatabaseWorkingType type)
+FGLocalWeatherDatabase::FGLocalWeatherDatabase(const sgVec3& position, const WeatherPrecision visibility, const DatabaseWorkingType type)
 {
     cerr << "Initializing FGLocalWeatherDatabase\n";
     cerr << "-----------------------------------\n";
@@ -109,7 +109,7 @@ FGLocalWeatherDatabase::FGLocalWeatherDatabase(const sgVec3& posititon, const We
 
     DatabaseStatus = type;
     global = 0;            //just get sure...
-    sgCopyVec3(last_known_position, posititon);
+    sgCopyVec3(last_known_position, position);
 
 
     theFGLocalWeatherDatabase = this;
@@ -120,7 +120,7 @@ FGLocalWeatherDatabase::FGLocalWeatherDatabase(const sgVec3& posititon, const We
        {
            global = new FGGlobalWeatherDatabase;       //initialize GlobalDatabase
            global->setDatabaseStatus(FGGlobalWeatherDatabase_working);
-           tileLocalWeather(global->getAll(posititon, WeatherVisibility, 3));
+           tileLocalWeather(global->getAll(position, WeatherVisibility, 3));
        }
        break;
 
index dcd6c016bccc078df73deb769f5a1716569b1736..3ca680727a64163045b0b441279166a39671dc48 100644 (file)
@@ -130,21 +130,28 @@ public:
     /* Constructor and Destructor                                          */
     /************************************************************************/
     FGLocalWeatherDatabase(
-       const sgVec3&             posititon,
-       const WeatherPrecision    visibility = DEFAULT_WEATHER_VISIBILIY,
+       const sgVec3&             position,
+       const WeatherPrecision    visibility = DEFAULT_WEATHER_VISIBILITY,
        const DatabaseWorkingType type       = PREFERED_WORKING_TYPE);
 
     FGLocalWeatherDatabase(
-       const WeatherPrecision    posititon_lat,
-       const WeatherPrecision    posititon_lon,
-       const WeatherPrecision    posititon_alt,
-       const WeatherPrecision    visibility = DEFAULT_WEATHER_VISIBILIY,
+       const WeatherPrecision    position_lat,
+       const WeatherPrecision    position_lon,
+       const WeatherPrecision    position_alt,
+       const WeatherPrecision    visibility = DEFAULT_WEATHER_VISIBILITY,
        const DatabaseWorkingType type       = PREFERED_WORKING_TYPE)
     {
+       cout << "This constructor is broken and should *NOT* be used!" << endl;
+       exit(-1);
+
        sgVec3 position;
-       sgSetVec3( position, posititon_lat, posititon_lon, posititon_alt );
+       sgSetVec3( position, position_lat, position_lon, position_alt );
+
+       // Christian: the following line does not do what you intend.
+       // It just creates a new FGLocalWeatherDatabase which isn't
+       // assigned to anything so it is immediately discared.
 
-       FGLocalWeatherDatabase( position, visibility, type );
+       /* BAD --> */ FGLocalWeatherDatabase( position, visibility, type );
     }
 
     ~FGLocalWeatherDatabase();
@@ -202,10 +209,10 @@ void fgUpdateWeatherDatabase(void);
 /****************************************************************************/
 void inline FGLocalWeatherDatabase::setWeatherVisibility(const WeatherPrecision visibility)
 {
-    if (visibility >= MINIMUM_WEATHER_VISIBILIY)
+    if (visibility >= MINIMUM_WEATHER_VISIBILITY)
        WeatherVisibility = visibility;
     else
-       WeatherVisibility = MINIMUM_WEATHER_VISIBILIY;
+       WeatherVisibility = MINIMUM_WEATHER_VISIBILITY;
 
     //This code doesn't belong here as this is the optical visibility and not
     //the visibility of the weather database (that should be bigger...). The
index 49a6c774faaaa9e7890697b30218d7820b6c1d74..f1476b0c88c7a507521cebe03e73e3264e6e5a61 100644 (file)
@@ -54,8 +54,8 @@ HISTORY
 typedef float WeatherPrecision;
 
 //set the minimum visibility to get a at least half way realistic weather
-#define MINIMUM_WEATHER_VISIBILIY 10.0    /* metres */
-#define DEFAULT_WEATHER_VISIBILIY 32000.0 /* metres */
+#define MINIMUM_WEATHER_VISIBILITY 10.0    /* metres */
+#define DEFAULT_WEATHER_VISIBILITY 32000.0 /* metres */
 //prefered way the database is working
 #define PREFERED_WORKING_TYPE default_mode