]> git.mxchange.org Git - flightgear.git/commitdiff
Avoid some useless file accesses
authorThorstenB <brehmt@gmail.com>
Sat, 20 Aug 2011 21:02:26 +0000 (23:02 +0200)
committerThorstenB <brehmt@gmail.com>
Sat, 20 Aug 2011 21:13:27 +0000 (23:13 +0200)
Empty "markers" in between scenery search paths shouldn't be
considered when building search paths.

src/Airports/xmlloader.cxx
src/Scenery/tilemgr.cxx

index 3d65f7756611241764dab8025d71da53682c44d1..273e2f67f6508c772760a825196f82f4773e3d01 100644 (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;
 }
index 75e0b9f9266b5e8972f703feb259c33be920988a..52cadfd05a7956a857ba7ff2f35657e0684afd7e 100644 (file)
@@ -255,12 +255,15 @@ 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 {
          fullPath.append(modelPath);