]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - plugins/vfspk3/vfs.cpp
Concat all found shaderlist.txt files to build the shader list
[xonotic/netradiant.git] / plugins / vfspk3 / vfs.cpp
index 6220f773982757ca5262498c7bb3ce3986cc6c91..8b52b535cefb3350000fd3296b4de5cf5c73a1e4 100644 (file)
@@ -661,29 +661,33 @@ public:
     g_observers.detach(observer);
   }
 
-  Archive* getArchive(const char* archiveName)
+  Archive* getArchive(const char* archiveName, bool pakonly)
   {
     for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
     {
-      if((*i).is_pakfile)
-      {
-        if(path_equal((*i).name.c_str(), archiveName))
-        {
-          return (*i).archive;
-        }
-      }
+      if(pakonly && !(*i).is_pakfile)
+        continue;
+
+      if(path_equal((*i).name.c_str(), archiveName))
+        return (*i).archive;
     }
     return 0;
   }
-  void forEachArchive(const ArchiveNameCallback& callback)
+  void forEachArchive(const ArchiveNameCallback& callback, bool pakonly, bool reverse)
   {
+    if (reverse)
+      g_archives.reverse();
+
     for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
     {
-      if((*i).is_pakfile)
-      {
-        callback((*i).name.c_str());
-      }
+      if(pakonly && !(*i).is_pakfile)
+        continue;
+
+      callback((*i).name.c_str());
     }
+
+    if (reverse)
+      g_archives.reverse();
   }
 };