1
0
Fork 0

Removed configuration option --with-old-mouse and FG_OLD_MOUSE macro.

Removed configuration option --with-new-environment and
FG_NEW_ENVIRONMENT macro.

Added configuration option --with-weathercm and FG_WEATHERCM macro.

FGEnvironment is now the default; use --with-weathercm to get the old
weather.
This commit is contained in:
david 2002-05-12 00:12:19 +00:00
parent 94a667a061
commit 1fe50d4cd2
11 changed files with 61 additions and 73 deletions

View file

@ -64,15 +64,12 @@
/* Define to include Oliver's networking support */ /* Define to include Oliver's networking support */
#undef FG_NETWORK_OLK #undef FG_NETWORK_OLK
/* Define to avoid Christian's new weather code */ /* Define to use Christian's old weather code */
#undef FG_NEW_ENVIRONMENT #undef FG_WEATHERCM
/* Define to enable new Plib joystick features (post 1.4) */ /* Define to enable new Plib joystick features (post 1.4) */
#undef FG_PLIB_JOYSTICK_GETNAME #undef FG_PLIB_JOYSTICK_GETNAME
/* Define to use old mouse support */
#undef FG_OLD_MOUSE
/* Define if we are building FGFS (should always be defined) */ /* Define if we are building FGFS (should always be defined) */
#undef FGFS #undef FGFS

View file

@ -24,11 +24,11 @@
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#ifdef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# include <Environment/environment_mgr.hxx> # include <Environment/environment_mgr.hxx>
# include <Environment/environment.hxx> # include <Environment/environment.hxx>
#else
#include <WeatherCM/FGLocalWeatherDatabase.h>
#endif #endif
//Constructor //Constructor
@ -189,12 +189,12 @@ void FGApproach::Update() {
// ============================================================================ // ============================================================================
void FGApproach::get_active_runway() { void FGApproach::get_active_runway() {
#ifdef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
FGEnvironment stationweather =
globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
#else
sgVec3 position = { lat, lon, elev }; sgVec3 position = { lat, lon, elev };
FGPhysicalProperty stationweather = WeatherDatabase->get(position); FGPhysicalProperty stationweather = WeatherDatabase->get(position);
#else
FGEnvironment stationweather =
globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
#endif #endif
SGPath path( globals->get_fg_root() ); SGPath path( globals->get_fg_root() );
@ -203,9 +203,7 @@ void FGApproach::get_active_runway() {
FGRunways runways( path.c_str() ); FGRunways runways( path.c_str() );
//Set the heading to into the wind //Set the heading to into the wind
#ifdef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
double hdg = stationweather.get_wind_from_heading_deg();
#else
double wind_x = stationweather.Wind[0]; double wind_x = stationweather.Wind[0];
double wind_y = stationweather.Wind[1]; double wind_y = stationweather.Wind[1];
@ -223,6 +221,8 @@ void FGApproach::get_active_runway() {
if (hdg < 0.0) if (hdg < 0.0)
hdg += 360.0; hdg += 360.0;
} }
#else
double hdg = stationweather.get_wind_from_heading_deg();
#endif #endif
FGRunway runway; FGRunway runway;

View file

@ -40,11 +40,11 @@ SG_USING_STD(cout);
//#include <simgear/misc/sgstream.hxx> //#include <simgear/misc/sgstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#ifdef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# include <Environment/environment_mgr.hxx> # include <Environment/environment_mgr.hxx>
# include <Environment/environment.hxx> # include <Environment/environment.hxx>
#else
# include <WeatherCM/FGLocalWeatherDatabase.h>
#endif #endif
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
@ -143,12 +143,12 @@ void FGATIS::UpdateTransmission() {
int hours; int hours;
// int minutes; // int minutes;
#ifdef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
FGEnvironment stationweather =
globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
#else
sgVec3 position = { lat, lon, elev }; sgVec3 position = { lat, lon, elev };
FGPhysicalProperty stationweather = WeatherDatabase->get(position); FGPhysicalProperty stationweather = WeatherDatabase->get(position);
#else
FGEnvironment stationweather =
globals->get_environment_mgr()->getEnvironment(lat, lon, elev);
#endif #endif
transmission = ""; transmission = "";
@ -177,10 +177,10 @@ void FGATIS::UpdateTransmission() {
// Get the temperature // Get the temperature
// (Hardwire it for now since the global property returns the temperature at the current altitude // (Hardwire it for now since the global property returns the temperature at the current altitude
//temperature = fgGetDouble("/environment/weather/temperature-K"); //temperature = fgGetDouble("/environment/weather/temperature-K");
#ifdef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
sprintf(buf, "%i", int(stationweather.get_temperature_degc()));
#else
sprintf(buf, "%i", int(stationweather.Temperature - 273.15)); sprintf(buf, "%i", int(stationweather.Temperature - 273.15));
#else
sprintf(buf, "%i", int(stationweather.get_temperature_degc()));
#endif #endif
transmission += " Temperature "; transmission += " Temperature ";
transmission += buf; transmission += buf;
@ -190,10 +190,10 @@ void FGATIS::UpdateTransmission() {
// pressure is: stationweather.AirPressure in Pascal // pressure is: stationweather.AirPressure in Pascal
// Get the visibility // Get the visibility
#ifdef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
visibility = stationweather.get_visibility_m();
#else
visibility = fgGetDouble("/environment/visibility-m"); visibility = fgGetDouble("/environment/visibility-m");
#else
visibility = stationweather.get_visibility_m();
#endif #endif
sprintf(buf, "%i", int(visibility/1600)); sprintf(buf, "%i", int(visibility/1600));
transmission += " Visibility "; transmission += " Visibility ";
@ -217,18 +217,7 @@ void FGATIS::UpdateTransmission() {
path.append( "runways.mk4" ); path.append( "runways.mk4" );
FGRunways runways( path.c_str() ); FGRunways runways( path.c_str() );
#ifdef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
double speed = stationweather.get_wind_speed_kt();
double hdg = stationweather.get_wind_from_heading_deg();
if (speed == 0) {
transmission += " Winds light and variable";
} else {
// FIXME: get gust factor in somehow
char buf2[72];
sprintf(buf2, "%s %i %s %i %s", " Winds ", int(speed),
" knots from ", int(hdg), " degrees");
}
#else
//Set the heading to into the wind //Set the heading to into the wind
double wind_x = stationweather.Wind[0]; double wind_x = stationweather.Wind[0];
double wind_y = stationweather.Wind[1]; double wind_y = stationweather.Wind[1];
@ -253,6 +242,17 @@ void FGATIS::UpdateTransmission() {
sprintf(buf2, "%s %i %s %i %s", " Winds ", int(speed), " knots from ", int(hdg), " degrees"); sprintf(buf2, "%s %i %s %i %s", " Winds ", int(speed), " knots from ", int(hdg), " degrees");
transmission += buf2; transmission += buf2;
} }
#else
double speed = stationweather.get_wind_speed_kt();
double hdg = stationweather.get_wind_from_heading_deg();
if (speed == 0) {
transmission += " Winds light and variable";
} else {
// FIXME: get gust factor in somehow
char buf2[72];
sprintf(buf2, "%s %i %s %i %s", " Winds ", int(speed),
" knots from ", int(hdg), " degrees");
}
#endif #endif
string rwy_no = runways.search(ident, int(hdg)); string rwy_no = runways.search(ident, int(hdg));

View file

@ -169,7 +169,7 @@ void balloon::update()
/* later, but currently was my main concern to get it going... */ /* later, but currently was my main concern to get it going... */
/************************************************************************/ /************************************************************************/
#ifndef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
sgVec3 v; sgVec3 v;
FGPhysicalProperty wdbpos = WeatherDatabase->get(position); FGPhysicalProperty wdbpos = WeatherDatabase->get(position);
@ -226,7 +226,7 @@ void balloon::update()
sgVec3 fTotal, fFriction, fLift; sgVec3 fTotal, fFriction, fLift;
sgScaleVec3(fTotal, gravity_vector, mTotal); sgScaleVec3(fTotal, gravity_vector, mTotal);
#ifndef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
sgScaleVec3(fFriction, v, cw_envelope * wind_facing_area_of_balloon * WeatherDatabase->getAirDensity(position) * speed / 2.0); //wind resistance sgScaleVec3(fFriction, v, cw_envelope * wind_facing_area_of_balloon * WeatherDatabase->getAirDensity(position) * speed / 2.0); //wind resistance
sgScaleVec3(fLift, gravity_vector, -balloon_envelope_volume * wdbpos.AirPressure / (287.14 * wdbpos.Temperature)); sgScaleVec3(fLift, gravity_vector, -balloon_envelope_volume * wdbpos.AirPressure / (287.14 * wdbpos.Temperature));
#endif #endif

View file

@ -197,11 +197,9 @@ FGInput::init ()
glutKeyboardUpFunc(GLUTkeyup); glutKeyboardUpFunc(GLUTkeyup);
glutSpecialFunc(GLUTspecialkey); glutSpecialFunc(GLUTspecialkey);
glutSpecialUpFunc(GLUTspecialkeyup); glutSpecialUpFunc(GLUTspecialkeyup);
#ifndef FG_OLD_MOUSE
glutMouseFunc (GLUTmouse); glutMouseFunc (GLUTmouse);
glutMotionFunc (GLUTmotion); glutMotionFunc (GLUTmotion);
glutPassiveMotionFunc (GLUTmotion); glutPassiveMotionFunc (GLUTmotion);
#endif
} }
void void

View file

@ -4,10 +4,10 @@ else
SERIAL_LIBS = SERIAL_LIBS =
endif endif
if ENABLE_NEW_ENVIRONMENT if ENABLE_WEATHERCM
WEATHER_LIBS = $(top_builddir)/src/Environment/libEnvironment.a
else
WEATHER_LIBS = $(top_builddir)/src/WeatherCM/libWeatherCM.a WEATHER_LIBS = $(top_builddir)/src/WeatherCM/libWeatherCM.a
else
WEATHER_LIBS = $(top_builddir)/src/Environment/libEnvironment.a
endif endif
if ENABLE_NETWORK_OLK if ENABLE_NETWORK_OLK

View file

@ -111,7 +111,7 @@
#include <Time/moonpos.hxx> #include <Time/moonpos.hxx>
#include <Time/tmp.hxx> #include <Time/tmp.hxx>
#ifndef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h> # include <WeatherCM/FGLocalWeatherDatabase.h>
#else #else
# include <Environment/environment_mgr.hxx> # include <Environment/environment_mgr.hxx>
@ -842,7 +842,7 @@ bool fgInitSubsystems( void ) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Initialize the weather modeling subsystem // Initialize the weather modeling subsystem
#ifndef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
// Initialize the WeatherDatabase // Initialize the WeatherDatabase
SG_LOG(SG_GENERAL, SG_INFO, "Creating LocalWeatherDatabase"); SG_LOG(SG_GENERAL, SG_INFO, "Creating LocalWeatherDatabase");
sgVec3 position; sgVec3 position;

View file

@ -34,11 +34,11 @@
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Time/tmp.hxx> #include <Time/tmp.hxx>
#include <FDM/UIUCModel/uiuc_aircraftdir.h> #include <FDM/UIUCModel/uiuc_aircraftdir.h>
#ifndef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h> # include <WeatherCM/FGLocalWeatherDatabase.h>
#else #else
# include <Environment/environment.hxx> # include <Environment/environment.hxx>
#endif // FG_NEW_ENVIRONMENT #endif // FG_WEATHERCM
#include <Objects/matlib.hxx> #include <Objects/matlib.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>
@ -53,11 +53,11 @@ SG_USING_STD(istream);
SG_USING_STD(ostream); SG_USING_STD(ostream);
#endif #endif
#if !defined(FG_NEW_ENVIRONMENT) #ifdef FG_WEATHERCM
static double getWindNorth (); static double getWindNorth ();
static double getWindEast (); static double getWindEast ();
static double getWindDown (); static double getWindDown ();
#endif // FG_NEW_ENVIRONMENT #endif // FG_WEATHERCM
static bool winding_ccw = true; // FIXME: temporary static bool winding_ccw = true; // FIXME: temporary
@ -401,7 +401,7 @@ getHeadingMag ()
} }
#if !defined(FG_NEW_ENVIRONMENT) #ifdef FG_WEATHERCM
/** /**
* Get the current visibility (meters). * Get the current visibility (meters).
@ -487,7 +487,7 @@ setWindDown (double speed)
speed); speed);
} }
#endif // FG_NEW_ENVIRONMENT #endif // FG_WEATHERCM
static long static long
getWarp () getWarp ()
@ -590,7 +590,7 @@ fgInitProps ()
fgTie("/orientation/heading-magnetic-deg", getHeadingMag); fgTie("/orientation/heading-magnetic-deg", getHeadingMag);
// Environment // Environment
#if !defined(FG_NEW_ENVIRONMENT) #ifdef FG_WEATHERCM
fgTie("/environment/visibility-m", getVisibility, setVisibility); fgTie("/environment/visibility-m", getVisibility, setVisibility);
fgSetArchivable("/environment/visibility-m"); fgSetArchivable("/environment/visibility-m");
fgTie("/environment/wind-from-north-fps", getWindNorth, setWindNorth); fgTie("/environment/wind-from-north-fps", getWindNorth, setWindNorth);

View file

@ -151,7 +151,7 @@ float scene_farplane = 120000.0f;
static double delta_time_sec = 0; static double delta_time_sec = 0;
#ifndef FG_NEW_ENVIRONMENT #ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h> # include <WeatherCM/FGLocalWeatherDatabase.h>
#else #else
# include <Environment/environment_mgr.hxx> # include <Environment/environment_mgr.hxx>
@ -885,8 +885,8 @@ static void fgMainLoop( void ) {
// init routine and we don't have to worry about it again. // init routine and we don't have to worry about it again.
#endif #endif
#ifdef FG_NEW_ENVIRONMENT #ifndef FG_WEATHERCM
globals->get_environment_mgr()->update(0); // FIXME: use real delta time globals->get_environment_mgr()->update(delta_time_sec);
#endif #endif
// Fix elevation. I'm just sticking this here for now, it should // Fix elevation. I'm just sticking this here for now, it should
@ -1300,13 +1300,6 @@ int fgGlutInitEvents( void ) {
// keyboard and mouse callbacks are set in FGInput::init // keyboard and mouse callbacks are set in FGInput::init
#ifdef FG_OLD_MOUSE
// call guiMouseFunc() whenever our little rodent is used
glutMouseFunc ( guiMouseFunc );
glutMotionFunc (guiMotionFunc );
glutPassiveMotionFunc (guiMotionFunc );
#endif
// call fgMainLoop() whenever there is // call fgMainLoop() whenever there is
// nothing else to do // nothing else to do
glutIdleFunc( fgIdleFunction ); glutIdleFunc( fgIdleFunction );
@ -1344,7 +1337,7 @@ int mainLoop( int argc, char **argv ) {
globals = new FGGlobals; globals = new FGGlobals;
#if defined(FG_NEW_ENVIRONMENT) #ifndef FG_WEATHERCM
globals->set_environment_mgr(new FGEnvironmentMgr); globals->set_environment_mgr(new FGEnvironmentMgr);
#endif #endif

View file

@ -908,7 +908,7 @@ parse_option (const string& arg)
fgSetDouble("/environment/wind-from-heading-deg", dir); fgSetDouble("/environment/wind-from-heading-deg", dir);
fgSetDouble("/environment/wind-speed-kt", speed); fgSetDouble("/environment/wind-speed-kt", speed);
#if !defined (FG_NEW_ENVIRONMENT) #ifdef FG_WEATHERCM
// convert to fps // convert to fps
speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600); speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
while (dir > 360) while (dir > 360)
@ -920,7 +920,7 @@ parse_option (const string& arg)
speed * cos(dir)); speed * cos(dir));
fgSetDouble("/environment/wind-from-east-fps", fgSetDouble("/environment/wind-from-east-fps",
speed * sin(dir)); speed * sin(dir));
#endif // FG_NEW_ENVIRONMENT #endif // FG_WEATHERCM
} else if ( arg.find( "--wp=" ) == 0 ) { } else if ( arg.find( "--wp=" ) == 0 ) {
parse_wp( arg.substr( 5 ) ); parse_wp( arg.substr( 5 ) );
} else if ( arg.find( "--flight-plan=") == 0) { } else if ( arg.find( "--flight-plan=") == 0) {

View file

@ -1,7 +1,7 @@
if ENABLE_NEW_ENVIRONMENT if ENABLE_WEATHERCM
WEATHER_DIR = Environment
else
WEATHER_DIR = WeatherCM WEATHER_DIR = WeatherCM
else
WEATHER_DIR = Environment
endif endif
if ENABLE_NETWORK_OLK if ENABLE_NETWORK_OLK