From 1fe50d4cd228f72172caca64947ddaa058bf3139 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 May 2002 00:12:19 +0000 Subject: [PATCH] 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. --- acconfig.h | 7 ++--- src/ATC/approach.cxx | 22 +++++++-------- src/ATC/atis.cxx | 50 +++++++++++++++++----------------- src/FDM/Balloon/BalloonSim.cpp | 4 +-- src/Input/input.cxx | 2 -- src/Main/Makefile.am | 6 ++-- src/Main/fg_init.cxx | 4 +-- src/Main/fg_props.cxx | 14 +++++----- src/Main/main.cxx | 15 +++------- src/Main/options.cxx | 4 +-- src/Makefile.am | 6 ++-- 11 files changed, 61 insertions(+), 73 deletions(-) diff --git a/acconfig.h b/acconfig.h index 33bc604f4..5bdfd0d11 100644 --- a/acconfig.h +++ b/acconfig.h @@ -64,15 +64,12 @@ /* Define to include Oliver's networking support */ #undef FG_NETWORK_OLK -/* Define to avoid Christian's new weather code */ -#undef FG_NEW_ENVIRONMENT +/* Define to use Christian's old weather code */ +#undef FG_WEATHERCM /* Define to enable new Plib joystick features (post 1.4) */ #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) */ #undef FGFS diff --git a/src/ATC/approach.cxx b/src/ATC/approach.cxx index 5c2e6431f..d5faedd13 100644 --- a/src/ATC/approach.cxx +++ b/src/ATC/approach.cxx @@ -24,11 +24,11 @@ #include -#ifdef FG_NEW_ENVIRONMENT -#include -#include +#ifdef FG_WEATHERCM +# include #else -#include +# include +# include #endif //Constructor @@ -189,12 +189,12 @@ void FGApproach::Update() { // ============================================================================ void FGApproach::get_active_runway() { -#ifdef FG_NEW_ENVIRONMENT - FGEnvironment stationweather = - globals->get_environment_mgr()->getEnvironment(lat, lon, elev); -#else +#ifdef FG_WEATHERCM sgVec3 position = { lat, lon, elev }; FGPhysicalProperty stationweather = WeatherDatabase->get(position); +#else + FGEnvironment stationweather = + globals->get_environment_mgr()->getEnvironment(lat, lon, elev); #endif SGPath path( globals->get_fg_root() ); @@ -203,9 +203,7 @@ void FGApproach::get_active_runway() { FGRunways runways( path.c_str() ); //Set the heading to into the wind -#ifdef FG_NEW_ENVIRONMENT - double hdg = stationweather.get_wind_from_heading_deg(); -#else +#ifdef FG_WEATHERCM double wind_x = stationweather.Wind[0]; double wind_y = stationweather.Wind[1]; @@ -223,6 +221,8 @@ void FGApproach::get_active_runway() { if (hdg < 0.0) hdg += 360.0; } +#else + double hdg = stationweather.get_wind_from_heading_deg(); #endif FGRunway runway; diff --git a/src/ATC/atis.cxx b/src/ATC/atis.cxx index 67b378e67..eb2f39209 100644 --- a/src/ATC/atis.cxx +++ b/src/ATC/atis.cxx @@ -40,11 +40,11 @@ SG_USING_STD(cout); //#include #include -#ifdef FG_NEW_ENVIRONMENT +#ifdef FG_WEATHERCM +# include +#else # include # include -#else -# include #endif #include
@@ -143,12 +143,12 @@ void FGATIS::UpdateTransmission() { int hours; // int minutes; -#ifdef FG_NEW_ENVIRONMENT - FGEnvironment stationweather = - globals->get_environment_mgr()->getEnvironment(lat, lon, elev); -#else +#ifdef FG_WEATHERCM sgVec3 position = { lat, lon, elev }; FGPhysicalProperty stationweather = WeatherDatabase->get(position); +#else + FGEnvironment stationweather = + globals->get_environment_mgr()->getEnvironment(lat, lon, elev); #endif transmission = ""; @@ -177,10 +177,10 @@ void FGATIS::UpdateTransmission() { // Get the temperature // (Hardwire it for now since the global property returns the temperature at the current altitude //temperature = fgGetDouble("/environment/weather/temperature-K"); -#ifdef FG_NEW_ENVIRONMENT - sprintf(buf, "%i", int(stationweather.get_temperature_degc())); -#else +#ifdef FG_WEATHERCM sprintf(buf, "%i", int(stationweather.Temperature - 273.15)); +#else + sprintf(buf, "%i", int(stationweather.get_temperature_degc())); #endif transmission += " Temperature "; transmission += buf; @@ -190,10 +190,10 @@ void FGATIS::UpdateTransmission() { // pressure is: stationweather.AirPressure in Pascal // Get the visibility -#ifdef FG_NEW_ENVIRONMENT - visibility = stationweather.get_visibility_m(); -#else +#ifdef FG_WEATHERCM visibility = fgGetDouble("/environment/visibility-m"); +#else + visibility = stationweather.get_visibility_m(); #endif sprintf(buf, "%i", int(visibility/1600)); transmission += " Visibility "; @@ -217,18 +217,7 @@ void FGATIS::UpdateTransmission() { path.append( "runways.mk4" ); FGRunways runways( path.c_str() ); -#ifdef FG_NEW_ENVIRONMENT - 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 +#ifdef FG_WEATHERCM //Set the heading to into the wind double wind_x = stationweather.Wind[0]; 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"); 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 string rwy_no = runways.search(ident, int(hdg)); diff --git a/src/FDM/Balloon/BalloonSim.cpp b/src/FDM/Balloon/BalloonSim.cpp index a60bb9d56..0fc4982c0 100644 --- a/src/FDM/Balloon/BalloonSim.cpp +++ b/src/FDM/Balloon/BalloonSim.cpp @@ -169,7 +169,7 @@ void balloon::update() /* later, but currently was my main concern to get it going... */ /************************************************************************/ -#ifndef FG_NEW_ENVIRONMENT +#ifdef FG_WEATHERCM sgVec3 v; FGPhysicalProperty wdbpos = WeatherDatabase->get(position); @@ -226,7 +226,7 @@ void balloon::update() sgVec3 fTotal, fFriction, fLift; 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(fLift, gravity_vector, -balloon_envelope_volume * wdbpos.AirPressure / (287.14 * wdbpos.Temperature)); #endif diff --git a/src/Input/input.cxx b/src/Input/input.cxx index f7ce15856..0ee0ebbdf 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -197,11 +197,9 @@ FGInput::init () glutKeyboardUpFunc(GLUTkeyup); glutSpecialFunc(GLUTspecialkey); glutSpecialUpFunc(GLUTspecialkeyup); -#ifndef FG_OLD_MOUSE glutMouseFunc (GLUTmouse); glutMotionFunc (GLUTmotion); glutPassiveMotionFunc (GLUTmotion); -#endif } void diff --git a/src/Main/Makefile.am b/src/Main/Makefile.am index 27ba8c0a4..f21c5cc66 100644 --- a/src/Main/Makefile.am +++ b/src/Main/Makefile.am @@ -4,10 +4,10 @@ else SERIAL_LIBS = endif -if ENABLE_NEW_ENVIRONMENT -WEATHER_LIBS = $(top_builddir)/src/Environment/libEnvironment.a -else +if ENABLE_WEATHERCM WEATHER_LIBS = $(top_builddir)/src/WeatherCM/libWeatherCM.a +else +WEATHER_LIBS = $(top_builddir)/src/Environment/libEnvironment.a endif if ENABLE_NETWORK_OLK diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 229fe2718..7ec9eaa97 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -111,7 +111,7 @@ #include