From: jmt Date: Wed, 9 Dec 2009 18:18:35 +0000 (+0000) Subject: As discussed on the mailing list, make the 'nearest' GPS command use scratch lat... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=35cb89626e75d2bf5b80cf746b11bb83b3deeb52;p=flightgear.git As discussed on the mailing list, make the 'nearest' GPS command use scratch lat/lon as the search origin if they are valid. --- diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index 4477dd4ed..57b67b455 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -1428,10 +1428,15 @@ void GPS::loadNearest() int limitCount = _scratchNode->getIntValue("max-results", 1); double cutoffDistance = _scratchNode->getDoubleValue("cutoff-nm", 400.0); - clearScratch(); // clear now, regardless of whether we find a match or not + SGGeod searchPos = _indicated_pos; + if (isScratchPositionValid()) { + searchPos = _scratchPos; + } + clearScratch(); // clear now, regardless of whether we find a match or not + _searchResults = - FGPositioned::findClosestN(_indicated_pos, limitCount, cutoffDistance, f.get()); + FGPositioned::findClosestN(searchPos, limitCount, cutoffDistance, f.get()); _searchResultsCached = true; _searchResultIndex = 0; _searchIsRoute = false;