1
0
Fork 0

As discussed on the mailing list, make the 'nearest' GPS command use scratch lat/lon as the search origin if they are valid.

This commit is contained in:
jmt 2009-12-09 18:18:35 +00:00 committed by Tim Moore
parent c453d1a0cc
commit 35cb89626e

View 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;