]> git.mxchange.org Git - flightgear.git/blobdiff - src/Environment/realwx_ctrl.cxx
#545: Fix ATC chatter sound settings being ignored
[flightgear.git] / src / Environment / realwx_ctrl.cxx
index e555cb6b4d858c3137cf0a86f5f33cb0a80769da..d98bcd5d27911507d42021fd758e8eed741c3a68 100644 (file)
@@ -186,9 +186,22 @@ BasicRealWxController::BasicRealWxController( SGPropertyNode_ptr rootNode, Metar
             fgGetNode( rootNode->getStringValue("metar", "/environment/metar"), true ), metarRequester ));
 
     BOOST_FOREACH( SGPropertyNode_ptr n, rootNode->getChildren("metar") ) {
-       SG_LOG( SG_ENVIRONMENT, SG_INFO, "Adding metar properties at " << n->getStringValue() );
-        _metarProperties.push_back( new LiveMetarProperties( 
-            fgGetNode( n->getStringValue(), true ), metarRequester ));
+       SGPropertyNode_ptr metarNode = fgGetNode( n->getStringValue(), true );
+
+       // check for duplicate entries
+       bool existingElement = false;
+       BOOST_FOREACH( LiveMetarProperties_ptr p, _metarProperties ) {
+         if( p->get_root_node()->getPath() == metarNode->getPath() ) {
+           existingElement = true;
+           break;
+         }
+       }
+
+       if( existingElement )
+         continue;
+
+       SG_LOG( SG_ENVIRONMENT, SG_INFO, "Adding metar properties at " << metarNode->getPath() );
+        _metarProperties.push_back( new LiveMetarProperties( metarNode, metarRequester ));
     }
 }