]> git.mxchange.org Git - flightgear.git/commitdiff
Fixes for cygwin32 builds.
authorcurt <curt>
Thu, 27 Apr 2000 03:26:36 +0000 (03:26 +0000)
committercurt <curt>
Thu, 27 Apr 2000 03:26:36 +0000 (03:26 +0000)
acconfig.h
src/Airports/simple.cxx
src/Airports/simple.hxx
src/Cockpit/radiostack.cxx
src/Cockpit/radiostack.hxx
src/Cockpit/steam.cxx
src/Include/config.h.in
src/Navaids/Makefile.am
src/Network/joyclient.cxx
src/NetworkOLK/net_send.cxx

index a5fe5539a070fe876e4e223a43c03a7d82bb6920..6a80f8990b500c725d91597e7c1c7e4d813af960 100644 (file)
 /* 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
 
index 2cafe024297362a4ff39270cf12b93a44526e61d..9ac98469b2389117ad5cabccb6233c7dff2eff47 100644 (file)
 // $Id$
 
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <sys/types.h>         // for gdbm open flags
 #include <sys/stat.h>          // for gdbm open flags
-#include <gdbm.h>
+
+#ifdef HAVE_GDBM
+#  include <gdbm.h>
+#else
+#  include <simgear/gdbm/gdbm.h>
+#endif
 
 #include <simgear/compiler.h>
 
index e8f513697c07430036f595b38dca6b02d06ddabc..6543ddce6170fd301e1557e971166eceb248eb62 100644 (file)
 #endif                                   
 
 
-#include <gdbm.h>
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#ifdef HAVE_GDBM
+#  include <gdbm.h>
+#else
+#  include <simgear/gdbm/gdbm.h>
+#endif
 
 #include <simgear/compiler.h>
 
index e29364a8c1bc5371d1570c06a6cc32950b190878..080e8aacf7ebf306626b35006781368a5058f75f 100644 (file)
@@ -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;
     }
 }
 
index 34cd1dab4add56303c8a0d8cc9d02077cd38b4a0..ee46ee5245660a6ecb175954a4c2b54bbef62c4a 100644 (file)
@@ -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; }
index 4d31ca1384a93c5584f96f4885373ab8df1da25f..0c82bd72f38234702b4250b20d12cd70b8e63f66 100644 (file)
@@ -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;
 }
 
 
index 9e9c102f09ab03fc21fd2b4c1bade29278415981..a6e80a62c5f8285b84ff8951b0da059e202a4781 100644 (file)
@@ -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
 
index 0a8a61acdf263eb7e8ea68eae17e4a5015235c4a..1a020e7a3dbc99fb38dc871b2f88d99b7f115576 100644 (file)
@@ -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
index f399ce5898703942793bffadf2bc5cddf5c1c542..bf546544bf34b38dc1605568fd711d0ebfd9835d 100644 (file)
@@ -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 ) {
index 0d59262488d77ace44013af5c229fcab2ebe32d4..80724cc78cda982ea8ffe15831f1b8f182b1fd2e 100644 (file)
@@ -53,12 +53,12 @@ int result;
 
 #if defined( __CYGWIN__ )
 #include <errno.h>
-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;