1
0
Fork 0

Fixes to Christian's latest weather submission.

This commit is contained in:
curt 1999-10-21 22:53:12 +00:00
parent 2751545008
commit adf5011f80
4 changed files with 34 additions and 24 deletions

View file

@ -432,12 +432,15 @@ bool fgInitSubsystems( void ) {
#ifndef FG_OLD_WEATHER
// Initialize the WeatherDatabase
FG_LOG(FG_GENERAL, FG_INFO, "Creating LocalWeatherDatabase");
FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
new FGLocalWeatherDatabase(
current_aircraft.fdm_state->get_Latitude(),
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 );
current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER );
FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
new FGLocalWeatherDatabase( position );
// cout << theFGLocalWeatherDatabase << endl;
// cout << "visibility = "
// << theFGLocalWeatherDatabase->getWeatherVisibility() << endl;
WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase;

View 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;

View 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)
{
sgVec3 position;
sgSetVec3( position, posititon_lat, posititon_lon, posititon_alt );
cout << "This constructor is broken and should *NOT* be used!" << endl;
exit(-1);
FGLocalWeatherDatabase( position, visibility, type );
sgVec3 position;
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.
/* 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

View 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