/* 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
#include <simgear/misc/sg_path.hxx>
-#ifdef FG_NEW_ENVIRONMENT
-#include <Environment/environment_mgr.hxx>
-#include <Environment/environment.hxx>
+#ifdef FG_WEATHERCM
+# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
-#include <WeatherCM/FGLocalWeatherDatabase.h>
+# include <Environment/environment_mgr.hxx>
+# include <Environment/environment.hxx>
#endif
//Constructor
// ============================================================================
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() );
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];
if (hdg < 0.0)
hdg += 360.0;
}
+#else
+ double hdg = stationweather.get_wind_from_heading_deg();
#endif
FGRunway runway;
//#include <simgear/misc/sgstream.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.hxx>
-#else
-# include <WeatherCM/FGLocalWeatherDatabase.h>
#endif
#include <Main/fg_props.hxx>
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 = "";
// 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;
// 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 ";
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];
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));
/* 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);
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
glutKeyboardUpFunc(GLUTkeyup);
glutSpecialFunc(GLUTspecialkey);
glutSpecialUpFunc(GLUTspecialkeyup);
-#ifndef FG_OLD_MOUSE
glutMouseFunc (GLUTmouse);
glutMotionFunc (GLUTmotion);
glutPassiveMotionFunc (GLUTmotion);
-#endif
}
void
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
#include <Time/moonpos.hxx>
#include <Time/tmp.hxx>
-#ifndef FG_NEW_ENVIRONMENT
+#ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# include <Environment/environment_mgr.hxx>
////////////////////////////////////////////////////////////////////
// Initialize the weather modeling subsystem
-#ifndef FG_NEW_ENVIRONMENT
+#ifdef FG_WEATHERCM
// Initialize the WeatherDatabase
SG_LOG(SG_GENERAL, SG_INFO, "Creating LocalWeatherDatabase");
sgVec3 position;
#include <Aircraft/aircraft.hxx>
#include <Time/tmp.hxx>
#include <FDM/UIUCModel/uiuc_aircraftdir.h>
-#ifndef FG_NEW_ENVIRONMENT
+#ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# include <Environment/environment.hxx>
-#endif // FG_NEW_ENVIRONMENT
+#endif // FG_WEATHERCM
#include <Objects/matlib.hxx>
#include <GUI/gui.h>
SG_USING_STD(ostream);
#endif
-#if !defined(FG_NEW_ENVIRONMENT)
+#ifdef FG_WEATHERCM
static double getWindNorth ();
static double getWindEast ();
static double getWindDown ();
-#endif // FG_NEW_ENVIRONMENT
+#endif // FG_WEATHERCM
static bool winding_ccw = true; // FIXME: temporary
}
-#if !defined(FG_NEW_ENVIRONMENT)
+#ifdef FG_WEATHERCM
/**
* Get the current visibility (meters).
speed);
}
-#endif // FG_NEW_ENVIRONMENT
+#endif // FG_WEATHERCM
static long
getWarp ()
fgTie("/orientation/heading-magnetic-deg", getHeadingMag);
// Environment
-#if !defined(FG_NEW_ENVIRONMENT)
+#ifdef FG_WEATHERCM
fgTie("/environment/visibility-m", getVisibility, setVisibility);
fgSetArchivable("/environment/visibility-m");
fgTie("/environment/wind-from-north-fps", getWindNorth, setWindNorth);
static double delta_time_sec = 0;
-#ifndef FG_NEW_ENVIRONMENT
+#ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# include <Environment/environment_mgr.hxx>
// init routine and we don't have to worry about it again.
#endif
-#ifdef FG_NEW_ENVIRONMENT
- globals->get_environment_mgr()->update(0); // FIXME: use real delta time
+#ifndef FG_WEATHERCM
+ globals->get_environment_mgr()->update(delta_time_sec);
#endif
// Fix elevation. I'm just sticking this here for now, it should
// 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
// nothing else to do
glutIdleFunc( fgIdleFunction );
globals = new FGGlobals;
-#if defined(FG_NEW_ENVIRONMENT)
+#ifndef FG_WEATHERCM
globals->set_environment_mgr(new FGEnvironmentMgr);
#endif
fgSetDouble("/environment/wind-from-heading-deg", dir);
fgSetDouble("/environment/wind-speed-kt", speed);
-#if !defined (FG_NEW_ENVIRONMENT)
+#ifdef FG_WEATHERCM
// convert to fps
speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
while (dir > 360)
speed * cos(dir));
fgSetDouble("/environment/wind-from-east-fps",
speed * sin(dir));
-#endif // FG_NEW_ENVIRONMENT
+#endif // FG_WEATHERCM
} else if ( arg.find( "--wp=" ) == 0 ) {
parse_wp( arg.substr( 5 ) );
} else if ( arg.find( "--flight-plan=") == 0) {
-if ENABLE_NEW_ENVIRONMENT
-WEATHER_DIR = Environment
-else
+if ENABLE_WEATHERCM
WEATHER_DIR = WeatherCM
+else
+WEATHER_DIR = Environment
endif
if ENABLE_NETWORK_OLK