]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/cockpit.cxx
Use !strcmp for all property string-value comparisons.
[flightgear.git] / src / Cockpit / cockpit.cxx
index 6feb75bb348e135a770f4b6a1e3fdfcdd71fbff9..32d8c37438c2bc076d65f832d04206ba788a85f4 100644 (file)
@@ -39,6 +39,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/polar3d.hxx>
 #include <simgear/misc/props.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <Aircraft/aircraft.hxx>
 #include <Include/general.hxx>
@@ -182,7 +183,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()
@@ -196,7 +197,7 @@ float get_agl( void )
 {
     float agl;
 
-    if ( fgGetString("/sim/startup/units") == "feet" ) {
+    if ( !strcmp("/sim/startup/units", "feet") ) {
         agl = (current_aircraft.fdm_state->get_Altitude()
                - scenery.get_cur_elev() * SG_METER_TO_FEET);
     } else {
@@ -246,7 +247,7 @@ float get_vfc_tris_culled   ( void )
 float get_climb_rate( void )
 {
     float climb_rate;
-    if ( fgGetString("/sim/startup/units") == "feet" ) {
+    if ( !strcmp("/sim/startup/units", "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;
@@ -258,7 +259,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;
     
@@ -744,3 +745,4 @@ void fgCockpitUpdate( void ) {
     
     glViewport( 0, 0, iwidth, iheight );
 }
+