]> git.mxchange.org Git - flightgear.git/commitdiff
Make command "clear-metar" work
authorTorsten Dreyer <torsten@ŧ3r.de>
Mon, 30 Mar 2015 14:13:01 +0000 (16:13 +0200)
committerTorsten Dreyer <torsten@ŧ3r.de>
Mon, 30 Mar 2015 14:13:01 +0000 (16:13 +0200)
Didn't work if the client used a non-expanded property path
(like the airport dialog)

src/Environment/realwx_ctrl.cxx

index 04d79ab38d30d638c134cb02acb428c1ee191648..867e85bede22c3c851879457f526a66a22523a12 100644 (file)
@@ -342,10 +342,13 @@ void BasicRealWxController::addMetarAtPath(const string& propPath, const string&
 
 void BasicRealWxController::removeMetarAtPath(const string &propPath)
 {
+  SGPropertyNode_ptr n = fgGetNode(propPath,false);
   MetarPropertiesList::iterator it = _metarProperties.begin();
   for (; it != _metarProperties.end(); ++it) {
     LiveMetarProperties_ptr p(*it);
-    if( p->get_root_node()->getPath() == propPath ) {
+    // don not compare unprocessed property path
+    // /foo/bar[0]/baz equals /foo/bar/baz
+    if( p->get_root_node()->getPath() == n->getPath() ) {
       _metarProperties.erase(it);
       // final ref will drop, and delete the MetarProperties, when we return
       return;