]> git.mxchange.org Git - flightgear.git/blobdiff - Cockpit/cockpit.cxx
Renamed class fgFLIGHT to class FGState as per request by JSB.
[flightgear.git] / Cockpit / cockpit.cxx
index 650e23ca3a66eafefa6e6b7e0abfd3dd49ae8e3e..876e2100a554b8f1dd773406ad80da186e4e22b0 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>
@@ -66,20 +66,21 @@ static pCockpit ac_cockpit;
 
 double get_latitude( void )
 {
-       fgFLIGHT *f;
-       f = current_aircraft.flight;
+       FGState *f;
+       f = current_aircraft.fdm_state;
 
 //     return( toDM(FG_Latitude * RAD_TO_DEG) );
-       return((double)((int)( FG_Latitude * RAD_TO_DEG)) );
+       return((double)((int)( f->get_Latitude() * RAD_TO_DEG)) );
 }
+
 double get_lat_min( void )
 {
-       fgFLIGHT *f;
+       FGState *f;
        double      a, d;
 
-       f = current_aircraft.flight;
+       f = current_aircraft.fdm_state;
        
-       a = FG_Latitude * RAD_TO_DEG;   
+       a = f->get_Latitude() * RAD_TO_DEG;     
        if (a < 0.0) {
                a = -a;
        }
@@ -90,20 +91,20 @@ double get_lat_min( void )
 
 double get_longitude( void )
 {
-       fgFLIGHT *f;
-       f = current_aircraft.flight;
+       FGState *f;
+       f = current_aircraft.fdm_state;
 
 //     return( toDM(FG_Longitude * RAD_TO_DEG) );
-       return((double)((int) (FG_Longitude * RAD_TO_DEG)) );
+       return((double)((int) (f->get_Longitude() * RAD_TO_DEG)) );
 }
 double get_long_min( void )
 {
-       fgFLIGHT *f;
+       FGState *f;
        double  a, d;
 
-       f = current_aircraft.flight;
+       f = current_aircraft.fdm_state;
        
-       a = FG_Longitude * RAD_TO_DEG;  
+       a = f->get_Longitude() * RAD_TO_DEG;    
        if (a < 0.0) {
                a = -a;
        }
@@ -138,80 +139,80 @@ double get_rudderval( void )
 
 double get_speed( void )
 {
-       fgFLIGHT *f;
+       FGState *f;
 
-       f = current_aircraft.flight;
-       return( FG_V_equiv_kts );    // Make an explicit function call.
+       f = current_aircraft.fdm_state;
+       return( f->get_V_equiv_kts() );    // Make an explicit function call.
 }
 
 double get_aoa( void )
 {
-       fgFLIGHT *f;
+       FGState *f;
               
-       f = current_aircraft.flight;
-       return( FG_Gamma_vert_rad * RAD_TO_DEG );
+       f = current_aircraft.fdm_state;
+       return( f->get_Gamma_vert_rad() * RAD_TO_DEG );
 }
 
 double get_roll( void )
 {
-       fgFLIGHT *f;
+       FGState *f;
 
-       f = current_aircraft.flight;
-       return( FG_Phi );
+       f = current_aircraft.fdm_state;
+       return( f->get_Phi() );
 }
 
 double get_pitch( void )
 {
-       fgFLIGHT *f;
+       FGState *f;
               
-       f = current_aircraft.flight;
-       return( FG_Theta );
+       f = current_aircraft.fdm_state;
+       return( f->get_Theta() );
 }
 
 double get_heading( void )
 {
-       fgFLIGHT *f;
+       FGState *f;
 
-       f = current_aircraft.flight;
-       return( FG_Psi * RAD_TO_DEG );
+       f = current_aircraft.fdm_state;
+       return( f->get_Psi() * RAD_TO_DEG );
 }
 
 double get_altitude( void )
 {
-       fgFLIGHT *f;
+       FGState *f;
        // double rough_elev;
 
-       f = current_aircraft.flight;
-       // rough_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC,
-       //                                 FG_Latitude  * RAD_TO_ARCSEC);
+       f = current_aircraft.fdm_state;
+       // rough_elev = mesh_altitude(f->get_Longitude() * RAD_TO_ARCSEC,
+       //                                 f->get_Latitude()  * RAD_TO_ARCSEC);
 
        if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
-           return FG_Altitude;
+           return f->get_Altitude();
        } else {
-           return FG_Altitude * FEET_TO_METER;
+           return f->get_Altitude() * FEET_TO_METER;
        }
 }
 
 double get_agl( void )
 {
-        fgFLIGHT *f;
+        FGState *f;
 
-        f = current_aircraft.flight;
+        f = current_aircraft.fdm_state;
 
        if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
-           return FG_Altitude - scenery.cur_elev * METER_TO_FEET;
+           return f->get_Altitude() - scenery.cur_elev * METER_TO_FEET;
        } else {
-           return FG_Altitude * FEET_TO_METER - scenery.cur_elev;
+           return f->get_Altitude() * FEET_TO_METER - scenery.cur_elev;
        }
 }
 
 double get_sideslip( void )
 {
-        fgFLIGHT *f;
+        FGState *f;
         
-        f = current_aircraft.flight;
+        f = current_aircraft.fdm_state;
         
-        return( FG_Beta );
+        return( f->get_Beta() );
 }
 
 double get_frame_rate( void )
@@ -244,21 +245,21 @@ double get_vfc_tris_drawn   ( void )
 
 double get_climb_rate( void )
 {
-       fgFLIGHT *f;
+       FGState *f;
 
-       f = current_aircraft.flight;
+       f = current_aircraft.fdm_state;
 
        if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
-           return FG_Climb_Rate * 60.0;
+           return f->get_Climb_Rate() * 60.0;
        } else {
-           return FG_Climb_Rate * FEET_TO_METER * 60.0;
+           return f->get_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;
@@ -279,9 +280,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;
 }
@@ -292,9 +293,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.
@@ -304,12 +305,27 @@ void fgCockpitUpdate( void ) {
 
     if ( current_options.get_panel_status() && 
         (fabs(pview->view_offset) < 0.2) ) {
+       xglViewport(0, 0, pview->winWidth, pview->winHeight);
        fgPanelUpdate();
     }
 }
 
 
 // $Log$
+// Revision 1.25  1998/12/05 15:54:07  curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
+// Revision 1.24  1998/12/03 01:16:00  curt
+// Converted fgFLIGHT to a class.
+//
+// Revision 1.23  1998/11/09 23:38:50  curt
+// Panel updates from Friedemann.
+//
+// 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.