]> git.mxchange.org Git - flightgear.git/commitdiff
Fix wrong metar assignment in commradio
authorTorsten Dreyer <torsten@t3r.de>
Fri, 28 Feb 2014 21:36:29 +0000 (22:36 +0100)
committerTorsten Dreyer <torsten@t3r.de>
Fri, 28 Feb 2014 21:36:29 +0000 (22:36 +0100)
src/Instrumentation/commradio.cxx

index a16fe60b267a0b05f8a6b215d8c211e89984b342..ae631cd8bc88ca2125e50be77d8ce5ad142e7487 100644 (file)
@@ -243,6 +243,7 @@ public:
   void unbind();
 
 private:
+  int                _num;
   MetarBridgeRef     _metarBridge;
   FrequencyFormatter _useFrequencyFormatter;
   FrequencyFormatter _stbyFrequencyFormatter;
@@ -263,8 +264,9 @@ private:
 
 CommRadioImpl::CommRadioImpl( SGPropertyNode_ptr node ) :
     OutputProperties( fgGetNode("/instrumentation",true)->getNode(
-                        node->getStringValue("name", "nav"),
+                        node->getStringValue("name", "comm"),
                         node->getIntValue("number", 0), true)),
+    _num( node->getIntValue("number",0)),
     _metarBridge( new MetarBridge() ),
     _useFrequencyFormatter( _rootNode->getNode("frequencies/selected-mhz",true), 
                             _rootNode->getNode("frequencies/selected-mhz-fmt",true), 0.025 ),
@@ -291,7 +293,9 @@ CommRadioImpl::~CommRadioImpl()
 void CommRadioImpl::bind()
 {
   _metarBridge->setAtisNode( _atis.node() );
-  _metarBridge->setMetarPropertiesRoot( fgGetNode( "/environment/metar[3]", true ) );
+   // link the metar node. /environment/metar[3] is comm1 and /environment[4] is comm2.
+   // see FGDATA/Environment/environment.xml
+  _metarBridge->setMetarPropertiesRoot( fgGetNode( "/environment",true)->getNode("metar", _num+3, true ) );
   _metarBridge->bind();
 }