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 */
#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

View file

@ -24,11 +24,11 @@
#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
//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;

View file

@ -40,11 +40,11 @@ SG_USING_STD(cout);
//#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>
@ -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));

View file

@ -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

View file

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

View file

@ -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

View file

@ -111,7 +111,7 @@
#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>
@ -842,7 +842,7 @@ bool fgInitSubsystems( void ) {
////////////////////////////////////////////////////////////////////
// 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;

View file

@ -34,11 +34,11 @@
#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>
@ -53,11 +53,11 @@ SG_USING_STD(istream);
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
@ -401,7 +401,7 @@ getHeadingMag ()
}
#if !defined(FG_NEW_ENVIRONMENT)
#ifdef FG_WEATHERCM
/**
* Get the current visibility (meters).
@ -487,7 +487,7 @@ setWindDown (double speed)
speed);
}
#endif // FG_NEW_ENVIRONMENT
#endif // FG_WEATHERCM
static long
getWarp ()
@ -590,7 +590,7 @@ fgInitProps ()
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);

View file

@ -151,7 +151,7 @@ float scene_farplane = 120000.0f;
static double delta_time_sec = 0;
#ifndef FG_NEW_ENVIRONMENT
#ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# 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.
#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
@ -1300,13 +1300,6 @@ int fgGlutInitEvents( void ) {
// 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 );
@ -1344,7 +1337,7 @@ int mainLoop( int argc, char **argv ) {
globals = new FGGlobals;
#if defined(FG_NEW_ENVIRONMENT)
#ifndef FG_WEATHERCM
globals->set_environment_mgr(new FGEnvironmentMgr);
#endif

View file

@ -908,7 +908,7 @@ parse_option (const string& arg)
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)
@ -920,7 +920,7 @@ parse_option (const string& arg)
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) {

View file

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