From 5aa51e5780d6316822f6cf7f636c36b9fa6b6a34 Mon Sep 17 00:00:00 2001 From: jmt Date: Tue, 13 Oct 2009 22:01:48 +0000 Subject: [PATCH] Ensure we always create a GPS instrument. --- src/Instrumentation/instrument_mgr.cxx | 13 +++++++++++-- src/Instrumentation/instrument_mgr.hxx | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Instrumentation/instrument_mgr.cxx b/src/Instrumentation/instrument_mgr.cxx index e79f94630..380ccd2ee 100644 --- a/src/Instrumentation/instrument_mgr.cxx +++ b/src/Instrumentation/instrument_mgr.cxx @@ -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 ) ); diff --git a/src/Instrumentation/instrument_mgr.hxx b/src/Instrumentation/instrument_mgr.hxx index 0d0069733..00b6ddfd1 100644 --- a/src/Instrumentation/instrument_mgr.hxx +++ b/src/Instrumentation/instrument_mgr.hxx @@ -35,6 +35,7 @@ public: private: SGPropertyNode *config_props; + bool _explicitGps; }; #endif // __INSTRUMENT_MGR_HXX