]> git.mxchange.org Git - flightgear.git/commitdiff
Fix a bad copy-and-paste bug in namedFindClosest, which broke things in the
authorjmt <jmt>
Thu, 11 Jun 2009 09:47:26 +0000 (09:47 +0000)
committerTim Moore <timoore@redhat.com>
Thu, 11 Jun 2009 14:05:21 +0000 (16:05 +0200)
multiple-matches case.

src/Navaids/positioned.cxx

index 89660e24c1f06b8e5bb546b02dc899013c36b038..465bb5c187848ee611641570e0554d8ce95aa41f 100644 (file)
@@ -266,22 +266,22 @@ namedFindClosest(const std::string& aIdent, const SGGeod& aOrigin, FGPositioned:
   SGVec3d cartOrigin(SGVec3d::fromGeod(aOrigin));
   
   for (; it != range.second; ++it) {
-    FGPositioned::Type ty = range.first->second->type();
+    FGPositioned* r = it->second;
     if (aFilter) {
-      if (aFilter->hasTypeRange() && !aFilter->passType(ty)) {
+      if (aFilter->hasTypeRange() && !aFilter->passType(r->type())) {
         continue;
       }
       
-      if (!aFilter->pass(range.first->second)) {
+      if (!aFilter->pass(r)) {
         continue;
       }
     }
     
   // find distance
-    double d2 = distSqr(cartOrigin, it->second->cart());
+    double d2 = distSqr(cartOrigin, r->cart());
     if (d2 < minDist) {
       minDist = d2;
-      result = it->second;
+      result = r;
     }
   }