]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/cockpit.cxx
make headers include headers they depend on, don't rely on the c(xx)
[flightgear.git] / src / Cockpit / cockpit.cxx
index 70366cf407401c2bae53d359b4443efb24e8536e..4957e3a9b0b0182deab59508f073d469fb9e88ce 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
@@ -29,7 +29,9 @@
 #  include <windows.h>
 #endif
 
-#include <GL/glu.h>
+#include <simgear/compiler.h>
+
+#include SG_GLU_H
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -43,7 +45,9 @@
 
 #include <Aircraft/aircraft.hxx>
 #include <Include/general.hxx>
-#include <FDM/ADA.hxx>
+#ifdef ENABLE_SP_FMDS
+#include <FDM/SP/ADA.hxx>
+#endif
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 #include <Main/viewmgr.hxx>
@@ -203,10 +207,10 @@ float get_agl( void )
 
     if ( !strcmp(startup_units_node->getStringValue(), "feet") ) {
         agl = (current_aircraft.fdm_state->get_Altitude()
-               - globals->get_scenery()->get_cur_elev() * SG_METER_TO_FEET);
+               - current_aircraft.fdm_state->get_Runway_altitude());
     } else {
-        agl = (current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER
-               - globals->get_scenery()->get_cur_elev());
+        agl = (current_aircraft.fdm_state->get_Altitude()
+               - current_aircraft.fdm_state->get_Runway_altitude()) * SG_FEET_TO_METER;
     }
 
     return agl;
@@ -282,7 +286,7 @@ float get_view_direction( void )
 float get_dme( void )
 {
     static const SGPropertyNode * dme_node =
-        fgGetNode("/radios/dme/distance-nm");
+        fgGetNode("/instrumentation/dme/indicated-distance-nm");
 
     return dme_node->getFloatValue();
 }
@@ -337,6 +341,7 @@ float get_anzg   ( void )
     return anzg;
 }
 
+#ifdef ENABLE_SP_FMDS
 int get_iaux1 (void)
 {
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
@@ -516,7 +521,7 @@ float get_aux18 (void)
     FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
     return fdm->get_faux(10);
 }
-// #endif
+#endif
 // $$$ end - added, VS Renganathan 13 Oct 2K
 
 
@@ -713,45 +718,14 @@ void fgCockpitUpdate( void ) {
 
     int iwidth   = xsize_node->getIntValue();
     int iheight  = ysize_node->getIntValue();
-    float width  = iwidth;
-    // float height = iheight;
 
                                // FIXME: inefficient
     if ( hud_visibility_node->getBoolValue() ) {
         // This will check the global hud linked list pointer.
-        // If these is anything to draw it will.
+        // If there is anything to draw it will.
         fgUpdateHUD();
     }
 
-    if ( fgGetBool( "/sim/hud/draw-fps", false ) ) {
-        char buf[64];
-        float fps = get_frame_rate();
-        sprintf(buf,"%-5.1f", fps);
-
-        glMatrixMode( GL_PROJECTION );
-        glPushMatrix();
-        glLoadIdentity();
-        gluOrtho2D( 0, iwidth, 0, iheight );
-        glMatrixMode( GL_MODELVIEW );
-        glPushMatrix();
-        glLoadIdentity();
-
-        glDisable( GL_DEPTH_TEST );
-        glDisable( GL_LIGHTING );
-        
-        glColor3f( 0.9, 0.4, 0.2 );
-
-        guiFnt.drawString( buf,
-                          int(width - guiFnt.getStringWidth(buf) - 10),
-                           10 );
-        glEnable( GL_DEPTH_TEST );
-        glEnable( GL_LIGHTING );
-        glMatrixMode( GL_PROJECTION );
-        glPopMatrix();
-        glMatrixMode( GL_MODELVIEW );
-        glPopMatrix();
-    }
-    
     glViewport( 0, 0, iwidth, iheight );
 }