]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud.cxx
Fix various route-manager issues - HUD display of waypoints, some potential divide...
[flightgear.git] / src / Cockpit / hud.cxx
index 617909b2ae95f611469a3cc9a7440502545e5893..5c58abce6e38b18f60eed80aa7f065601edc534d 100644 (file)
@@ -38,6 +38,8 @@
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/props/props_io.hxx>
+
 #include <osg/GLU>
 
 #include <Aircraft/aircraft.hxx>
@@ -45,6 +47,7 @@
 #include <GUI/new_gui.hxx>           // FGFontCache
 #include <Main/globals.hxx>
 #include <Scenery/scenery.hxx>
+#include <Airports/runways.hxx>
 
 #include "hud.hxx"
 
@@ -258,9 +261,11 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
     }
 
     FGFontCache *fc = globals->get_fontcache();
-    HUD_Font = fc->getTexFont(fgGetString("/sim/hud/font/name", "Helvetica.txf"));
+    const char* fileName = fgGetString("/sim/hud/font/name", "Helvetica.txf");
+    HUD_Font = fc->getTexFont(fileName);
     if (!HUD_Font)
-        throw sg_throwable(string("/sim/hud/font/name is not a texture font"));
+        throw sg_io_exception("/sim/hud/font/name is not a texture font",
+                              sg_location(fileName));
 
     HUD_TextSize = fgGetFloat("/sim/hud/font/size", 10);
 
@@ -462,7 +467,9 @@ void drawHUD(osg::State* state)
                   fgGetDouble("/autopilot/settings/true-heading-deg") );
         HUD_TextList.add( fgText( 40, apY, hud_hdg_text ) );
         apY -= 15;
-
+    }
+  
+    if (fgGetBool("/autopilot/route-manager/active", false)) {
         string wp0_id = fgGetString( "/autopilot/route-manager/wp[0]/id" );
         if ( wp0_id.length() > 0 ) {
             snprintf( hud_wp0_text, 256, "%5s %6.1fnm %s", wp0_id.c_str(),