X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2FNavDataCache.cxx;h=f6756613bd6c19130d5c308b44c36282add9852f;hb=5c659b3970e9a4542519e0d528016c08f7ecb6c1;hp=88a43220069da5f9450aa5e0cdc7360e5bc5562e;hpb=7041ed907891f7be0205cafe13b218f9f2767efa;p=flightgear.git diff --git a/src/Navaids/NavDataCache.cxx b/src/Navaids/NavDataCache.cxx index 88a432200..f6756613b 100644 --- a/src/Navaids/NavDataCache.cxx +++ b/src/Navaids/NavDataCache.cxx @@ -1161,17 +1161,25 @@ bool NavDataCache::isRebuildRequired() SG_LOG(SG_NAVCACHE, SG_INFO, "NavCache: main cache rebuild required"); return true; } - - string sceneryPaths = simgear::strutils::join(globals->get_fg_scenery(), ";"); - if (readStringProperty("scenery_paths") != sceneryPaths) { - SG_LOG(SG_NAVCACHE, SG_INFO, "NavCache: scenery paths changed,dropping ground net"); - dropAllGroundnets(); - writeStringProperty("scenery_paths", sceneryPaths); - } + + dropGroundnetsIfRequired(); SG_LOG(SG_NAVCACHE, SG_INFO, "NavCache: no main cache rebuild required"); return false; } + +bool NavDataCache::dropGroundnetsIfRequired() +{ + string sceneryPaths = simgear::strutils::join(globals->get_fg_scenery(), ";"); + if (readStringProperty("scenery_paths") != sceneryPaths) { + SG_LOG(SG_NAVCACHE, SG_INFO, "NavCache: scenery paths changed, dropping ground nets"); + dropAllGroundnets(); + writeStringProperty("scenery_paths", sceneryPaths); + return true; + } + + return false; +} bool NavDataCache::rebuild() { @@ -1750,13 +1758,13 @@ char** NavDataCache::searchAirportNamesAndIdents(const std::string& aFilter) { sqlite3_stmt_ptr stmt; unsigned int numMatches = 0, numAllocated = 16; + string searchTerm("%" + aFilter + "%"); if (aFilter.empty()) { stmt = d->getAllAirports; numAllocated = 4096; // start much larger for all airports } else { stmt = d->searchAirports; - string s = "%" + aFilter + "%"; - sqlite_bind_stdstring(stmt, 1, s); + sqlite_bind_stdstring(stmt, 1, searchTerm); } char** result = (char**) malloc(sizeof(char*) * numAllocated); @@ -1916,7 +1924,7 @@ NavDataCache::findAirportRunway(const std::string& aName) AirportRunwayPair result; sqlite_bind_stdstring(d->findAirportRunway, 1, parts[0]); - sqlite_bind_stdstring(d->findAirportRunway, 2, parts[1]); + sqlite_bind_stdstring(d->findAirportRunway, 2, cleanRunwayNo(parts[1])); if (d->execSelect(d->findAirportRunway)) { result = AirportRunwayPair(sqlite3_column_int64(d->findAirportRunway, 0), @@ -1931,8 +1939,10 @@ NavDataCache::findAirportRunway(const std::string& aName) } PositionedID -NavDataCache::findILS(PositionedID airport, const string& runway, const string& navIdent) +NavDataCache::findILS(PositionedID airport, const string& aRunway, const string& navIdent) { + string runway(cleanRunwayNo(aRunway)); + sqlite_bind_stdstring(d->findILS, 1, navIdent); sqlite3_bind_int64(d->findILS, 2, airport); sqlite_bind_stdstring(d->findILS, 3, runway);