diff --git a/configure.ac b/configure.ac index 65f897252..5be1a33fd 100644 --- a/configure.ac +++ b/configure.ac @@ -70,18 +70,6 @@ fi AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno") -# Specify if we want to use WeatherCM instead of FGEnvironment. -# default to with_weathercm=no -AC_ARG_WITH(weathercm, [ --with-weathercm Use WeatherCM instead of FGEnvironment]) -if test "x$with_weathercm" = "xyes" ; then - echo "Building with WeatherCM" - AC_DEFINE([FG_WEATHERCM], 1, - [Define to build with Christian Mayer's weather code]) -else - echo "Building with FGEnvironment" -fi -AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes") - dnl Thread related checks AC_ARG_WITH(threads, [ --with-threads Include tile loading threads [default=no]]) if test "x$with_threads" = "xyes"; then @@ -522,7 +510,6 @@ AC_CONFIG_FILES([ \ src/Sound/Makefile \ src/Systems/Makefile \ src/Time/Makefile \ - src/WeatherCM/Makefile \ tests/Makefile \ utils/Makefile \ utils/TerraSync/Makefile \ @@ -548,12 +535,6 @@ fi echo -n "Automake version: " automake --version | head -1 -if test "x$with_weathercm" != "x"; then - echo "WeatherCM instead of FGEnvironment: $with_weathercm" -else - echo "Using FGEnvironment" -fi - if test "x$with_multiplayer" != "xno"; then echo "Building with multiplayer support" fi diff --git a/src/ATC/AIMgr.cxx b/src/ATC/AIMgr.cxx index 2c2a1bf56..621bf5ec8 100644 --- a/src/ATC/AIMgr.cxx +++ b/src/ATC/AIMgr.cxx @@ -34,12 +34,8 @@ # include // for directory reading #endif -#ifdef FG_WEATHERCM -# include -#else -# include -# include -#endif +#include +#include #include "AIMgr.hxx" #include "AILocalTraffic.hxx" @@ -379,19 +375,10 @@ void FGAIMgr::GenerateSimpleAirportTraffic(string ident, double min_dist) { // Check that the visibility is OK for IFR operation. double visibility; - #ifdef FG_WEATHERCM - //sgVec3 position = { aptpos.lat(), aptpos.lon(), aptpos.elev() }; - //FGPhysicalProperty stationweather = WeatherDatabase->get(position); - #else FGEnvironment stationweather = ((FGEnvironmentMgr *)globals->get_subsystem("environment")) ->getEnvironment(aptpos.lat(), aptpos.lon(), aptpos.elev()); // TODO - check whether this should take ft or m for elev. - #endif - #ifdef FG_WEATHERCM - visibility = fgGetDouble("/environment/visibility-m"); - #else visibility = stationweather.get_visibility_m(); - #endif // Technically we can do VFR down to 1 mile (1600m) but that's pretty murky! //cout << "vis = " << visibility << '\n'; if(visibility < 3000) return; diff --git a/src/ATC/approach.cxx b/src/ATC/approach.cxx index c036a2827..f8901029d 100644 --- a/src/ATC/approach.cxx +++ b/src/ATC/approach.cxx @@ -28,12 +28,8 @@ #include #include -#ifdef FG_WEATHERCM -# include -#else -# include -# include -#endif +#include +#include #include @@ -555,37 +551,11 @@ double FGApproach::round_alt( const bool hl, double alt ) { void FGApproach::get_active_runway() { //cout << "Entering FGApproach::get_active_runway()\n"; -#ifdef FG_WEATHERCM - sgVec3 position = { lat, lon, elev }; - FGPhysicalProperty stationweather = WeatherDatabase->get(position); -#else FGEnvironment stationweather = ((FGEnvironmentMgr *)globals->get_subsystem("environment")) ->getEnvironment(lat, lon, elev); -#endif -#ifdef FG_WEATHERCM - //Set the heading to into the wind - double wind_x = stationweather.Wind[0]; - double wind_y = stationweather.Wind[1]; - - double speed = sqrt( wind_x*wind_x + wind_y*wind_y ) * SG_METER_TO_NM / (60.0*60.0); - double hdg; - - //If no wind use 270degrees - if(speed == 0) { - hdg = 270; - } else { - // //normalize the wind to get the direction - //wind_x /= speed; wind_y /= speed; - - hdg = - atan2 ( wind_x, wind_y ) * SG_RADIANS_TO_DEGREES ; - if (hdg < 0.0) - hdg += 360.0; - } -#else double hdg = stationweather.get_wind_from_heading_deg(); -#endif FGRunway runway; if ( globals->get_runways()->search( ident, int(hdg), &runway) ) { diff --git a/src/ATC/atis.cxx b/src/ATC/atis.cxx index ff0da5767..4ab783d81 100644 --- a/src/ATC/atis.cxx +++ b/src/ATC/atis.cxx @@ -36,12 +36,8 @@ SG_USING_STD(cout); #include -#ifdef FG_WEATHERCM -# include -#else -# include -# include -#endif +#include +#include #include
#include
@@ -102,14 +98,9 @@ void FGATIS::UpdateTransmission() { int hours; // int minutes; - #ifdef FG_WEATHERCM - sgVec3 position = { lat, lon, elev }; - FGPhysicalProperty stationweather = WeatherDatabase->get(position); - #else FGEnvironment stationweather = ((FGEnvironmentMgr *)globals->get_subsystem("environment")) ->getEnvironment(lat, lon, elev); - #endif transmission = ""; @@ -139,11 +130,7 @@ void FGATIS::UpdateTransmission() { // Get the temperature int temp; - #ifdef FG_WEATHERCM - temp = int(stationweather.Temperature - 273.15); - #else temp = (int)stationweather.get_temperature_degc(); - #endif // HACK ALERT - at the moment the new environment subsystem returns bogus temperatures // FIXME - take out this hack when this gets fixed upstream @@ -162,11 +149,7 @@ void FGATIS::UpdateTransmission() { transmission += " degrees_Celsius"; // Get the visibility - #ifdef FG_WEATHERCM - visibility = fgGetDouble("/environment/visibility-m"); - #else visibility = stationweather.get_visibility_m(); - #endif sprintf(buf, "%i", int(visibility/1600)); transmission += " / Visibility "; tempstr1 = buf; @@ -198,48 +181,9 @@ void FGATIS::UpdateTransmission() { // Get the pressure / altimeter - #ifndef FG_WEATHERCM - double altimeter = stationweather.get_pressure_sea_level_inhg(); - sprintf(buf, "%.2f", altimeter); - transmission += " / Altimeter "; - tempstr1 = buf; - transmission += ConvertNumToSpokenDigits(tempstr1); - #endif - // Based on the airport-id and wind get the active runway //FGRunway *r; - #ifdef FG_WEATHERCM - //Set the heading to into the wind - double wind_x = stationweather.Wind[0]; - double wind_y = stationweather.Wind[1]; - - double speed = sqrt( wind_x*wind_x + wind_y*wind_y ) * SG_METER_TO_NM / (60.0*60.0); - double hdg; - - //If no wind use 270degrees - if(speed == 0) { - hdg = 270; - transmission += " / Winds_light_and_variable"; - } else { - // //normalize the wind to get the direction - //wind_x /= speed; wind_y /= speed; - - hdg = - atan2 ( wind_x, wind_y ) * SG_RADIANS_TO_DEGREES ; - if (hdg < 0.0) - hdg += 360.0; - - //add a description of the wind to the transmission - char buf5[10]; - char buf6[10]; - sprintf(buf5, "%i", int(speed)); - sprintf(buf6, "%i", int(hdg)); - tempstr1 = buf5; - tempstr2 = buf6; - transmission = transmission + " / Winds " + ConvertNumToSpokenDigits(tempstr1) + " knots from " - + ConvertNumToSpokenDigits(tempstr2) + " degrees"; - } - #else double speed = stationweather.get_wind_speed_kt(); double hdg = stationweather.get_wind_from_heading_deg(); if (speed == 0) { @@ -257,7 +201,6 @@ void FGATIS::UpdateTransmission() { transmission = transmission + " / Winds " + ConvertNumToSpokenDigits(tempstr1) + " knots from " + ConvertNumToSpokenDigits(tempstr2) + " degrees"; } - #endif string rwy_no = globals->get_runways()->search(ident, int(hdg)); if(rwy_no != "NN") { diff --git a/src/FDM/Balloon/BalloonSim.cpp b/src/FDM/Balloon/BalloonSim.cpp index de291d941..968bf12cf 100644 --- a/src/FDM/Balloon/BalloonSim.cpp +++ b/src/FDM/Balloon/BalloonSim.cpp @@ -45,9 +45,6 @@ HISTORY #include #include -#ifdef FG_WEATHERCM -# include -#endif #include "BalloonSim.h" @@ -171,35 +168,10 @@ void balloon::update() /* later, but currently was my main concern to get it going... */ /************************************************************************/ -#ifdef FG_WEATHERCM - sgVec3 v; - - FGPhysicalProperty wdbpos = WeatherDatabase->get(position); - - //get the current wind velocity and store it in v - //Point3D temp = wdbpos.Wind; - //sgSetVec3(v, temp.x(), temp.y(), temp.z()); - sgCopyVec3(v, wdbpos.Wind ); - - sgSubVec3(v, velocity); - float speed = sgLengthVec3(v); - - // calculate the density of the gas inside - double rho = wdbpos.AirPressure / (287.14 * T); - - // calculate the mass of the air - double mAir = rho * balloon_envelope_volume; - - // loss of energy by cooling down: - float k = 1.0 / (1.0/4.8 + 1.0/(4.8+3.4*speed) + l_of_the_envelope/lambda); - float Q = k * balloon_envelope_area * (dt/3600.0) * (wdbpos.Temperature - T); //(dt/3600.0) = time since last call in hours - -#else // I realy don't think there is a solution for this without WeatherCM // but this is a hack, and it's working -- EMH double mAir = 0; float Q = 0; -#endif // gain of energy by heating: if (fuel_left > 0.0) //but only with some fuel left ;-) @@ -228,10 +200,6 @@ void balloon::update() sgVec3 fTotal, fFriction, fLift; sgScaleVec3(fTotal, gravity_vector, mTotal); -#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 sgAddVec3(fTotal, fLift); sgAddVec3(fTotal, fFriction); diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx index 61b8fdec4..ebcacf96d 100644 --- a/src/FDM/JSBSim/JSBSim.cxx +++ b/src/FDM/JSBSim/JSBSim.cxx @@ -250,9 +250,6 @@ void FGJSBsim::init() // Explicitly call the superclass's // init method first. -#ifdef FG_WEATHERCM - Atmosphere->UseInternal(); -#else if (fgGetBool("/environment/params/control-fdm-atmosphere")) { Atmosphere->UseExternal(); Atmosphere->SetExTemperature( @@ -269,7 +266,6 @@ void FGJSBsim::init() } else { Atmosphere->UseInternal(); } -#endif fgic->SetVnorthFpsIC( wind_from_north->getDoubleValue() ); fgic->SetVeastFpsIC( wind_from_east->getDoubleValue() ); diff --git a/src/Main/Makefile.am b/src/Main/Makefile.am index b8a75ed20..675c09b78 100644 --- a/src/Main/Makefile.am +++ b/src/Main/Makefile.am @@ -1,9 +1,3 @@ -if ENABLE_WEATHERCM -WEATHER_LIBS = $(top_builddir)/src/WeatherCM/libWeatherCM.a -else -WEATHER_LIBS = $(top_builddir)/src/Environment/libEnvironment.a -endif - if ENABLE_MPLAYER_AS MPLAYER_LIBS = $(top_builddir)/src/MultiPlayer/libMultiPlayer.a else @@ -82,7 +76,7 @@ fgfs_LDADD = \ $(top_builddir)/src/Replay/libReplay.a \ $(top_builddir)/src/Systems/libSystems.a \ $(top_builddir)/src/Time/libTime.a \ - $(WEATHER_LIBS) \ + $(top_builddir)/src/Environment/libEnvironment.a \ $(CLOUD3D_LIBS) \ -lsgroute -lsgsky -lsgsound -lsgephem -lsgmaterial -lsgtgdb -lsgmodel \ -lsgtiming -lsgio -lsgscreen -lsgmath -lsgbucket -lsgprops -lsgdebug \ diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index d2ff2eea2..ec0a9b035 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -119,11 +119,7 @@ #include #endif -#ifdef FG_WEATHERCM -# include -#else -# include -#endif +#include #include "fg_init.hxx" #include "fg_io.hxx" @@ -1553,49 +1549,7 @@ bool fgInitSubsystems() { //////////////////////////////////////////////////////////////////// // Initialize the weather modeling subsystem -#ifdef FG_WEATHERCM - // Initialize the WeatherDatabase - SG_LOG(SG_GENERAL, SG_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() * SG_FEET_TO_METER ); - double init_vis = fgGetDouble("/environment/visibility-m"); - - FGLocalWeatherDatabase::DatabaseWorkingType working_type; - - if (!strcmp(fgGetString("/environment/weather/working-type"), "internet")) - { - working_type = FGLocalWeatherDatabase::use_internet; - } else { - working_type = FGLocalWeatherDatabase::default_mode; - } - - if ( init_vis > 0 ) { - FGLocalWeatherDatabase::theFGLocalWeatherDatabase = - new FGLocalWeatherDatabase( position, - globals->get_fg_root(), - working_type, - init_vis ); - } else { - FGLocalWeatherDatabase::theFGLocalWeatherDatabase = - new FGLocalWeatherDatabase( position, - globals->get_fg_root(), - working_type ); - } - - // cout << theFGLocalWeatherDatabase << endl; - // cout << "visibility = " - // << theFGLocalWeatherDatabase->getWeatherVisibility() << endl; - - WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase; - - // register the periodic update of the weather - globals->get_event_mgr()->add( "weather update", - &fgUpdateWeatherDatabase, 30000); -#else globals->add_subsystem("environment", new FGEnvironmentMgr); -#endif //////////////////////////////////////////////////////////////////// diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index 7f2c7e868..66a9086fb 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -37,11 +37,7 @@ #include #include