From: jmt Date: Thu, 11 Jun 2009 09:47:26 +0000 (+0000) Subject: Fix a bad copy-and-paste bug in namedFindClosest, which broke things in the X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=83c29b4f433475ca95f067e7a24aca54b502d49a;p=flightgear.git Fix a bad copy-and-paste bug in namedFindClosest, which broke things in the multiple-matches case. --- diff --git a/src/Navaids/positioned.cxx b/src/Navaids/positioned.cxx index 89660e24c..465bb5c18 100644 --- a/src/Navaids/positioned.cxx +++ b/src/Navaids/positioned.cxx @@ -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; } }