]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/cockpit.cxx
Moved src/Model/loader.[ch]xx and src/Model/model.[ch]xx to
[flightgear.git] / src / Cockpit / cockpit.cxx
index fa2780343f856e49b977dd611a015a804e51f731..3dd91cae214d8e81b17d4eb1ac0812087dcf4966 100644 (file)
@@ -29,7 +29,7 @@
 #  include <windows.h>
 #endif
 
-#include <GL/glut.h>
+#include GLUT_H
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -38,7 +38,7 @@
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/polar3d.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 #include <simgear/timing/sg_time.hxx>
 
 #include <Aircraft/aircraft.hxx>
@@ -52,6 +52,7 @@
 #include <GUI/gui.h>
 
 #include "cockpit.hxx"
+#include "hud.hxx"
 
 
 // This is a structure that contains all data related to
@@ -183,7 +184,7 @@ float get_altitude( void )
 
     float altitude;
 
-    if ( startup_units_node->getStringValue() == "feet" ) {
+    if ( !strcmp(startup_units_node->getStringValue(), "feet") ) {
         altitude = current_aircraft.fdm_state->get_Altitude();
     } else {
         altitude = (current_aircraft.fdm_state->get_Altitude()
@@ -195,14 +196,17 @@ float get_altitude( void )
 
 float get_agl( void )
 {
+    static const SGPropertyNode *startup_units_node
+        = fgGetNode("/sim/startup/units");
+
     float agl;
 
-    if ( fgGetString("/sim/startup/units") == "feet" ) {
+    if ( !strcmp(startup_units_node->getStringValue(), "feet") ) {
         agl = (current_aircraft.fdm_state->get_Altitude()
-               - scenery.get_cur_elev() * SG_METER_TO_FEET);
+               - globals->get_scenery()->get_cur_elev() * SG_METER_TO_FEET);
     } else {
         agl = (current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER
-               - scenery.get_cur_elev());
+               - globals->get_scenery()->get_cur_elev());
     }
 
     return agl;
@@ -246,8 +250,11 @@ float get_vfc_tris_culled   ( void )
 
 float get_climb_rate( void )
 {
+    static const SGPropertyNode *startup_units_node
+        = fgGetNode("/sim/startup/units");
+
     float climb_rate;
-    if ( fgGetString("/sim/startup/units") == "feet" ) {
+    if ( !strcmp(startup_units_node->getStringValue(), "feet") ) {
         climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
     } else {
         climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * SG_FEET_TO_METER * 60.0;
@@ -259,7 +266,7 @@ float get_climb_rate( void )
 
 float get_view_direction( void )
 {
-    double view_off = SGD_2PI - globals->get_current_view()->get_view_offset();
+    double view_off = SGD_2PI - globals->get_current_view()->getHeadingOffset_deg() * SGD_DEGREES_TO_RADIANS;
     double view = ( current_aircraft.fdm_state->get_Psi() + view_off)
        * SGD_RADIANS_TO_DEGREES;
     
@@ -745,3 +752,4 @@ void fgCockpitUpdate( void ) {
     
     glViewport( 0, 0, iwidth, iheight );
 }
+