]> git.mxchange.org Git - flightgear.git/blobdiff - Cockpit/cockpit.cxx
Converted to new logstream debugging facility. This allows release
[flightgear.git] / Cockpit / cockpit.cxx
index ed3932cfc8ddada5c1c0cab87b5759382b5baf2a..d55e1ffb46ea89acceb64d0841e13ae03ada3359 100644 (file)
@@ -40,7 +40,7 @@
 #include <string.h>
 
 #include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
 #include <Include/fg_constants.h>
 #include <Include/general.h>
 #include <Main/options.hxx>
@@ -50,7 +50,6 @@
 #include <Math/polar3d.hxx>
 #include <Scenery/scenery.hxx>
 #include <Time/fg_timer.hxx>
-#include <Weather/weather.h>
 
 #include "cockpit.hxx"
 
@@ -114,42 +113,27 @@ double get_long_min( void )
 
 double get_throttleval( void )
 {
-       fgCONTROLS *pcontrols;
-
-  pcontrols = current_aircraft.controls;
-  return pcontrols->throttle[0];     // Hack limiting to one engine
+    return controls.get_throttle( 0 );     // Hack limiting to one engine
 }
 
 double get_aileronval( void )
 {
-       fgCONTROLS *pcontrols;
-
-  pcontrols = current_aircraft.controls;
-  return pcontrols->aileron;
+    return controls.get_aileron();
 }
 
 double get_elevatorval( void )
 {
-       fgCONTROLS *pcontrols;
-
-  pcontrols = current_aircraft.controls;
-  return pcontrols->elevator;
+    return controls.get_elevator();
 }
 
 double get_elev_trimval( void )
 {
-       fgCONTROLS *pcontrols;
-
-  pcontrols = current_aircraft.controls;
-  return pcontrols->elevator_trim;
+    return controls.get_elevator_trim();
 }
 
 double get_rudderval( void )
 {
-       fgCONTROLS *pcontrols;
-
-  pcontrols = current_aircraft.controls;
-  return pcontrols->rudder;
+    return controls.get_rudder();
 }
 
 double get_speed( void )
@@ -201,18 +185,24 @@ double get_altitude( void )
        // rough_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC,
        //                                 FG_Latitude  * RAD_TO_ARCSEC);
 
-       return( FG_Altitude * FEET_TO_METER /* -rough_elev */ );
+       if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+           return FG_Altitude;
+       } else {
+           return FG_Altitude * FEET_TO_METER;
+       }
 }
 
 double get_agl( void )
 {
         fgFLIGHT *f;
-        double agl;
 
         f = current_aircraft.flight;
-        agl = FG_Altitude * FEET_TO_METER - scenery.cur_elev;
 
-        return( agl );
+       if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+           return FG_Altitude - scenery.cur_elev * METER_TO_FEET;
+       } else {
+           return FG_Altitude * FEET_TO_METER - scenery.cur_elev;
+       }
 }
 
 double get_sideslip( void )
@@ -258,13 +248,17 @@ double get_climb_rate( void )
 
        f = current_aircraft.flight;
 
-       return( FG_Climb_Rate * FEET_TO_METER * 60.0 );
+       if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
+           return FG_Climb_Rate * 60.0;
+       } else {
+           return FG_Climb_Rate * FEET_TO_METER * 60.0;
+       }
 }
 
 
 bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
 {
-    fgPrintf( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem\n");
+    FG_LOG( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem" );
 
     // cockpit->code = 1;      /* It will be aircraft dependent */
     // cockpit->status = 0;
@@ -285,9 +279,9 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
        fgPanelInit();
     }
 
-    fgPrintf( FG_COCKPIT, FG_INFO,
-             "  Code %d  Status %d\n",
-             ac_cockpit->code(), ac_cockpit->status() );
+    FG_LOG( FG_COCKPIT, FG_INFO,
+           "  Code " << ac_cockpit->code() << " Status " 
+           << ac_cockpit->status() );
     
     return true;
 }
@@ -298,9 +292,9 @@ void fgCockpitUpdate( void ) {
 
     pview = &current_view;
 
-    fgPrintf( FG_COCKPIT, FG_DEBUG,
-             "Cockpit: code %d   status %d\n",
-             ac_cockpit->code(), ac_cockpit->status() );
+    FG_LOG( FG_COCKPIT, FG_DEBUG,
+           "Cockpit: code " << ac_cockpit->code() << " status " 
+           << ac_cockpit->status() );
 
     if ( current_options.get_hud_status() ) {
        // This will check the global hud linked list pointer.
@@ -316,6 +310,21 @@ void fgCockpitUpdate( void ) {
 
 
 // $Log$
+// Revision 1.22  1998/11/06 21:17:45  curt
+// Converted to new logstream debugging facility.  This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
+// Revision 1.21  1998/11/02 23:04:02  curt
+// HUD units now display in feet by default with meters being a command line
+// option.
+//
+// Revision 1.20  1998/10/25 14:08:40  curt
+// Turned "struct fgCONTROLS" into a class, with inlined accessor functions.
+//
+// Revision 1.19  1998/10/17 01:33:56  curt
+// C++ ifying ...
+//
 // Revision 1.18  1998/10/16 23:27:23  curt
 // C++-ifying.
 //