]> git.mxchange.org Git - flightgear.git/commitdiff
As discussed on the mailing list, make the 'nearest' GPS command use scratch lat...
authorjmt <jmt>
Wed, 9 Dec 2009 18:18:35 +0000 (18:18 +0000)
committerTim Moore <timoore@redhat.com>
Fri, 11 Dec 2009 23:11:41 +0000 (00:11 +0100)
src/Instrumentation/gps.cxx

index 4477dd4eddaf23e5ce1e77b7ad6a0ddfda24694a..57b67b455a65f5e3bfd70685e6e935610787f693 100644 (file)
@@ -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;