1
0
Fork 0

Avoid some useless file accesses

Empty "markers" in between scenery search paths shouldn't be
considered when building search paths.
This commit is contained in:
ThorstenB 2011-08-20 23:02:26 +02:00
parent 18983c5387
commit cf2236351c
2 changed files with 19 additions and 13 deletions

View file

@ -96,13 +96,16 @@ bool XMLLoader::findAirportData(const std::string& aICAO,
aICAO.c_str(), fileName.c_str());
for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) {
SGPath path(*it);
path.append("Airports");
path.append(string(buffer));
if (path.exists()) {
aPath = path;
return true;
} // of path exists
// fg_senery contains empty strings as "markers" (see FGGlobals::set_fg_scenery)
if (!it->empty()) {
SGPath path(*it);
path.append("Airports");
path.append(string(buffer));
if (path.exists()) {
aPath = path;
return true;
} // of path exists
}
} // of scenery path iteration
return false;
}

View file

@ -255,11 +255,14 @@ FGTileMgr::loadTileModel(const string& modelPath, bool cacheModel)
string_list sc = globals->get_fg_scenery();
for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) {
SGPath tmpPath(*it);
tmpPath.append(modelPath);
if (tmpPath.exists()) {
fullPath = tmpPath;
break;
// fg_senery contains empty strings as "markers" (see FGGlobals::set_fg_scenery)
if (!it->empty()) {
SGPath tmpPath(*it);
tmpPath.append(modelPath);
if (tmpPath.exists()) {
fullPath = tmpPath;
break;
}
}
}
} else {