} 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 ) {
#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
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";
DatabaseStatus = type;
global = 0; //just get sure...
- sgCopyVec3(last_known_position, posititon);
+ sgCopyVec3(last_known_position, position);
theFGLocalWeatherDatabase = this;
{
global = new FGGlobalWeatherDatabase; //initialize GlobalDatabase
global->setDatabaseStatus(FGGlobalWeatherDatabase_working);
- tileLocalWeather(global->getAll(posititon, WeatherVisibility, 3));
+ tileLocalWeather(global->getAll(position, WeatherVisibility, 3));
}
break;
/* 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();
/****************************************************************************/
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
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