From 39f4bea43e26d724692b4ae6919b2bb7df74e847 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 27 Apr 2000 03:26:36 +0000 Subject: [PATCH] Fixes for cygwin32 builds. --- acconfig.h | 3 ++ src/Airports/simple.cxx | 11 +++- src/Airports/simple.hxx | 10 +++- src/Cockpit/radiostack.cxx | 8 +-- src/Cockpit/radiostack.hxx | 2 + src/Cockpit/steam.cxx | 100 +++++++++++++++++++++++------------- src/Include/config.h.in | 3 ++ src/Navaids/Makefile.am | 2 +- src/Network/joyclient.cxx | 2 +- src/NetworkOLK/net_send.cxx | 4 +- 10 files changed, 100 insertions(+), 45 deletions(-) diff --git a/acconfig.h b/acconfig.h index a5fe5539a..6a80f8990 100644 --- a/acconfig.h +++ b/acconfig.h @@ -181,6 +181,9 @@ /* Define if you have the wait3 system call. */ #undef HAVE_WAIT3 +/* Define if you have gdbm installed system wide. */ +#undef HAVE_GDBM + /* Define if you have zlib installed system wide. */ #undef HAVE_ZLIB diff --git a/src/Airports/simple.cxx b/src/Airports/simple.cxx index 2cafe0242..9ac98469b 100644 --- a/src/Airports/simple.cxx +++ b/src/Airports/simple.cxx @@ -24,9 +24,18 @@ // $Id$ +#ifdef HAVE_CONFIG_H +# include +#endif + #include // for gdbm open flags #include // for gdbm open flags -#include + +#ifdef HAVE_GDBM +# include +#else +# include +#endif #include diff --git a/src/Airports/simple.hxx b/src/Airports/simple.hxx index e8f513697..6543ddce6 100644 --- a/src/Airports/simple.hxx +++ b/src/Airports/simple.hxx @@ -32,7 +32,15 @@ #endif -#include +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_GDBM +# include +#else +# include +#endif #include diff --git a/src/Cockpit/radiostack.cxx b/src/Cockpit/radiostack.cxx index e29364a8c..080e8aacf 100644 --- a/src/Cockpit/radiostack.cxx +++ b/src/Cockpit/radiostack.cxx @@ -50,6 +50,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) { if ( current_ilslist->query( lon, lat, elev, nav1_freq, &ils, &nav1_heading, &nav1_dist) ) { nav1_inrange = true; + nav1_loc = true; nav1_lon = ils.get_loclon(); nav1_lat = ils.get_loclat(); nav1_elev = ils.get_gselev(); @@ -61,7 +62,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) { // << " dist = " << nav1_dist << endl; } else { nav1_inrange = false; - cout << "not picking up vor. :-(" << endl; + // cout << "not picking up vor. :-(" << endl; } // nav1 @@ -69,6 +70,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) { if ( current_navlist->query( lon, lat, elev, nav2_freq, &nav, &nav2_heading, &nav2_dist) ) { nav2_inrange = true; + nav2_loc = false; nav2_lon = nav.get_lon(); nav2_lat = nav.get_lat(); nav2_elev = nav.get_elev(); @@ -78,7 +80,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) { // << " dist = " << nav2_dist << endl; } else { nav2_inrange = false; - cout << "not picking up vor. :-(" << endl; + // cout << "not picking up vor. :-(" << endl; } // adf @@ -95,7 +97,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) { // << " dist = " << junk << endl; } else { adf_inrange = false; - cout << "not picking up adf. :-(" << endl; + // cout << "not picking up adf. :-(" << endl; } } diff --git a/src/Cockpit/radiostack.hxx b/src/Cockpit/radiostack.hxx index 34cd1dab4..ee46ee524 100644 --- a/src/Cockpit/radiostack.hxx +++ b/src/Cockpit/radiostack.hxx @@ -44,6 +44,7 @@ class FGRadioStack { double nav1_target_gs; bool nav2_inrange; + bool nav2_loc; double nav2_freq; double nav2_radial; double nav2_lon; @@ -98,6 +99,7 @@ public: inline double get_nav1_target_gs() const { return nav1_target_gs; } inline bool get_nav2_inrange() const { return nav2_inrange; } + inline bool get_nav2_loc() const { return nav2_loc; } inline double get_nav2_radial() const { return nav2_radial; } inline double get_nav2_lon() const { return nav2_lon; } inline double get_nav2_lat() const { return nav2_lat; } diff --git a/src/Cockpit/steam.cxx b/src/Cockpit/steam.cxx index 4d31ca138..0c82bd72f 100644 --- a/src/Cockpit/steam.cxx +++ b/src/Cockpit/steam.cxx @@ -214,6 +214,7 @@ void FGSteam::_CatchUp() // Everything below is a transient hack; expect it to disappear //////////////////////////////////////////////////////////////////////// +#if 0 /* KMYF ILS */ #define NAV1_LOC (1) #define NAV1_Lat ( 32.0 + 48.94/60.0) @@ -229,17 +230,11 @@ void FGSteam::_CatchUp() /* HAILE intersection */ #define ADF_Lat ( 32.0 + 46.79/60.0) #define ADF_Lon (-117.0 - 02.70/60.0) - +#endif double FGSteam::get_HackGS_deg () { - double x = current_radiostack->get_nav1_dist(); - double y = (FGBFI::getAltitude() - current_radiostack->get_nav1_elev()) - * FEET_TO_METER; - double angle = atan2( y, x ) * RAD_TO_DEG; - return current_radiostack->get_nav1_target_gs() - angle; - #if 0 double x,y,dme; if (0==NAV1_LOC) return 0.0; @@ -251,6 +246,16 @@ double FGSteam::get_HackGS_deg () { y = FGBFI::getAltitude() - NAV1_Alt; return 3.0 - (y/x) * 60.0 / 6000.0; #endif + + if ( current_radiostack->get_nav1_inrange() ) { + double x = current_radiostack->get_nav1_dist(); + double y = (FGBFI::getAltitude() - current_radiostack->get_nav1_elev()) + * FEET_TO_METER; + double angle = atan2( y, x ) * RAD_TO_DEG; + return current_radiostack->get_nav1_target_gs() - angle; + } else { + return 0.0; + } } @@ -265,16 +270,21 @@ double FGSteam::get_HackVOR1_deg () { r = atan2 ( x, y ) * RAD_TO_DEG - NAV1_Rad - FGBFI::getMagVar(); #endif - r = current_radiostack->get_nav1_radial() - - current_radiostack->get_nav1_heading() + 180.0; - // cout << "Radial = " << current_radiostack->get_nav1_radial() - // << " Bearing = " << current_radiostack->get_nav1_heading() << endl; + if ( current_radiostack->get_nav1_inrange() ) { + r = current_radiostack->get_nav1_radial() - + current_radiostack->get_nav1_heading() + 180.0; + // cout << "Radial = " << current_radiostack->get_nav1_radial() + // << " Bearing = " << current_radiostack->get_nav1_heading() + // << endl; - if (r> 180.0) r-=360.0; else - if (r<-180.0) r+=360.0; - if ( fabs(r) > 90.0 ) - r = ( r<0.0 ? -r-180.0 : -r+180.0 ); - if (NAV1_LOC) r*=5.0; + if (r> 180.0) r-=360.0; else + if (r<-180.0) r+=360.0; + if ( fabs(r) > 90.0 ) + r = ( r<0.0 ? -r-180.0 : -r+180.0 ); + if ( current_radiostack->get_nav1_loc() ) r*=5.0; + } else { + r = 0.0; + } return r; } @@ -291,37 +301,55 @@ double FGSteam::get_HackVOR2_deg () { r = atan2 ( x, y ) * RAD_TO_DEG - NAV2_Rad - FGBFI::getMagVar(); #endif - r = current_radiostack->get_nav2_radial() - - current_radiostack->get_nav2_heading() + 180.0; - // cout << "Radial = " << current_radiostack->get_nav1_radial() - // << " Bearing = " << current_radiostack->get_nav1_heading() << endl; + if ( current_radiostack->get_nav2_inrange() ) { + r = current_radiostack->get_nav2_radial() - + current_radiostack->get_nav2_heading() + 180.0; + // cout << "Radial = " << current_radiostack->get_nav1_radial() + // << " Bearing = " << current_radiostack->get_nav1_heading() << endl; - if (r> 180.0) r-=360.0; else - if (r<-180.0) r+=360.0; - if ( fabs(r) > 90.0 ) - r = ( r<0.0 ? -r-180.0 : -r+180.0 ); + if (r> 180.0) r-=360.0; else + if (r<-180.0) r+=360.0; + if ( fabs(r) > 90.0 ) + r = ( r<0.0 ? -r-180.0 : -r+180.0 ); + } else { + r = 0.0; + } + return r; } -double FGSteam::get_HackOBS1_deg () -{ return NAV1_Rad; +double FGSteam::get_HackOBS1_deg () { + return current_radiostack->get_nav1_radial(); } -double FGSteam::get_HackOBS2_deg () -{ return NAV2_Rad; +double FGSteam::get_HackOBS2_deg () { + return current_radiostack->get_nav2_radial(); } -double FGSteam::get_HackADF_deg () -{ double r; - double x,y; - y = 60.0 * ( ADF_Lat - FGBFI::getLatitude () ); - x = 60.0 * ( ADF_Lon - FGBFI::getLongitude() ) - * cos ( FGBFI::getLatitude () / RAD_TO_DEG ); - r = atan2 ( x, y ) * RAD_TO_DEG - FGBFI::getHeading (); - return r; +double FGSteam::get_HackADF_deg () { + double r; + +#if 0 + double x,y; + y = 60.0 * ( ADF_Lat - FGBFI::getLatitude () ); + x = 60.0 * ( ADF_Lon - FGBFI::getLongitude() ) + * cos ( FGBFI::getLatitude () / RAD_TO_DEG ); + r = atan2 ( x, y ) * RAD_TO_DEG - FGBFI::getHeading (); +#endif + + if ( current_radiostack->get_adf_inrange() ) { + r = current_radiostack->get_adf_heading() - FGBFI::getHeading() + 180.0; + + // cout << "Radial = " << current_radiostack->get_adf_heading() + // << " Heading = " << FGBFI::getHeading() << endl; + } else { + r = 0.0; + } + + return r; } diff --git a/src/Include/config.h.in b/src/Include/config.h.in index 9e9c102f0..a6e80a62c 100644 --- a/src/Include/config.h.in +++ b/src/Include/config.h.in @@ -72,6 +72,9 @@ /* Define if you have the vprintf function. */ #undef HAVE_VPRINTF +/* Define if you have gdbm installed system wide. */ +#undef HAVE_GDBM + /* Define if you have zlib installed system wide. */ #undef HAVE_ZLIB diff --git a/src/Navaids/Makefile.am b/src/Navaids/Makefile.am index 0a8a61acd..1a020e7a3 100644 --- a/src/Navaids/Makefile.am +++ b/src/Navaids/Makefile.am @@ -8,6 +8,6 @@ libNavaids_a_SOURCES = \ nav.hxx navlist.hxx navlist.cxx testnavs_SOURCES = testnavs.cxx -testnavs_LDADD = libNavaids.a -lsgdebug -lsgmath -lsgmisc -lz +testnavs_LDADD = libNavaids.a -lsgmath -lsgmisc -lsgdebug -lz INCLUDES += -I$(top_builddir) -I$(top_builddir)/src diff --git a/src/Network/joyclient.cxx b/src/Network/joyclient.cxx index f399ce589..bf546544b 100644 --- a/src/Network/joyclient.cxx +++ b/src/Network/joyclient.cxx @@ -71,7 +71,7 @@ bool FGJoyClient::process() { FG_LOG( FG_IO, FG_DEBUG, "Success reading data." ); int *msg; msg = (int *)buf; - FG_LOG( FG_IO, FG_INFO, "X = " << msg[0] << " Y = " << msg[1] ); + FG_LOG( FG_IO, FG_DEBUG, "X = " << msg[0] << " Y = " << msg[1] ); double aileron = ((double)msg[0] / 2048.0) - 1.0; double elevator = ((double)msg[1] / 2048.0) - 1.0; if ( fabs(aileron) < 0.05 ) { diff --git a/src/NetworkOLK/net_send.cxx b/src/NetworkOLK/net_send.cxx index 0d5926248..80724cc78 100644 --- a/src/NetworkOLK/net_send.cxx +++ b/src/NetworkOLK/net_send.cxx @@ -53,12 +53,12 @@ int result; #if defined( __CYGWIN__ ) #include -const char *const *sys_errlist = _sys_errlist; #else -extern const char *const sys_errlist[]; extern int errno; #endif +extern const char *const sys_errlist[]; + int current_port = 10000; u_short base_port = 10000; u_short end_port = 10010; -- 2.39.5