]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gps.cxx
As discussed on the mailing list, make the 'nearest' GPS command use scratch lat...
[flightgear.git] / 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;