]> git.mxchange.org Git - flightgear.git/commitdiff
Ensure we always create a GPS instrument.
authorjmt <jmt>
Tue, 13 Oct 2009 22:01:48 +0000 (22:01 +0000)
committerTim Moore <timoore@redhat.com>
Tue, 13 Oct 2009 22:42:37 +0000 (00:42 +0200)
src/Instrumentation/instrument_mgr.cxx
src/Instrumentation/instrument_mgr.hxx

index e79f94630a66cb9c284757445767a4d1a911f3ea..380ccd2ee8bae6dbae57b02ace3ebc969a2e675b 100644 (file)
@@ -51,7 +51,8 @@
 #include "agradar.hxx"
 #include "rad_alt.hxx"
 
-FGInstrumentMgr::FGInstrumentMgr ()
+FGInstrumentMgr::FGInstrumentMgr () :
+  _explicitGps(false)
 {
     set_subsystem("od_gauge", new FGODGauge);
     set_subsystem("hud", new HUD);
@@ -85,6 +86,14 @@ FGInstrumentMgr::FGInstrumentMgr ()
     }
 
     delete config_props;
+    
+    if (!_explicitGps) {
+      SG_LOG(SG_INSTR, SG_INFO, "creating default GPS instrument");
+      SGPropertyNode_ptr nd(new SGPropertyNode);
+      nd->setStringValue("name", "gps");
+      nd->setIntValue("number", 0);
+      set_subsystem("gps[0]", new GPS(nd));
+    }
 }
 
 FGInstrumentMgr::~FGInstrumentMgr ()
@@ -129,7 +138,7 @@ bool FGInstrumentMgr::build ()
 
         } else if ( name == "gps" ) {
             set_subsystem( id, new GPS( node ) );
-
+            _explicitGps = true;
         } else if ( name == "gsdi" ) {
             set_subsystem( id, new GSDI( node ) );
 
index 0d0069733b7bb1bd00e91080b8799b46bd9afe99..00b6ddfd1add5d5c3e09c0865c558fe05a1a412b 100644 (file)
@@ -35,6 +35,7 @@ public:
 
 private:
     SGPropertyNode *config_props;
+    bool _explicitGps;
 };
 
 #endif // __INSTRUMENT_MGR_HXX