]> git.mxchange.org Git - flightgear.git/commitdiff
HUD tweak - don't show cross-track error if it's (effectively) zero.
authorjmt <jmt>
Sun, 18 Oct 2009 21:08:22 +0000 (21:08 +0000)
committerTim Moore <timoore@redhat.com>
Mon, 19 Oct 2009 21:56:51 +0000 (23:56 +0200)
src/Cockpit/hud.cxx

index 27208d54089732c83bb15f8008e742c55a64336e..6b126a70235af2a100c85a82e6f9d0d96dfac294 100644 (file)
@@ -488,10 +488,16 @@ void drawHUD(osg::State* state)
       apY -= 15;
       
       double courseError = curWp->getDoubleValue("course-error-nm");
-      // generate an arrow indicatinng if the pilot should turn left or right
-      char dir = (courseError < 0.0) ? '<' : '>';
-      snprintf(hud_gps_text1, 256, "GPS TRK:%03.0f XTRK:%c%4.2fnm",
-        gps->getDoubleValue("indicated-track-magnetic-deg"), dir, fabs(courseError));
+      if (fabs(courseError) >= 0.01) {
+        // generate an arrow indicatinng if the pilot should turn left or right
+        char dir = (courseError < 0.0) ? '<' : '>';
+        snprintf(hud_gps_text1, 256, "GPS TRK:%03.0f XTRK:%c%4.2fnm",
+          gps->getDoubleValue("indicated-track-magnetic-deg"), dir, fabs(courseError));
+      } else { // on course, don't bother showing the XTRK error
+        snprintf(hud_gps_text1, 256, "GPS TRK:%03.0f",
+          gps->getDoubleValue("indicated-track-magnetic-deg"));
+      }
+      
       HUD_TextList.add( fgText( 40, apY, hud_gps_text1) );
       apY -= 15;
     } // of valid GPS output