]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
precache_playermodels: fix insidious bug; sounds loaded as models
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 11 Dec 2015 11:04:06 +0000 (22:04 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Fri, 11 Dec 2015 11:04:06 +0000 (22:04 +1100)
qcsrc/server/miscfunctions.qc

index e7eed32b43c5931998ca8425ab7a784f542b350c..07dd423dcde4d8c0cac9916aa5642d580a254f2e 100644 (file)
@@ -735,32 +735,20 @@ void precache_playermodel(string m)
 }
 void precache_all_playermodels(string pattern)
 {
-       float globhandle, i, n;
-       string f;
-
-       globhandle = search_begin(pattern, true, false);
-       if (globhandle < 0)
-               return;
-       n = search_getsize(globhandle);
-       for (i = 0; i < n; ++i)
+       int globhandle = search_begin(pattern, true, false);
+       if (globhandle < 0) return;
+       int n = search_getsize(globhandle);
+       for (int i = 0; i < n; ++i)
        {
-               //print(search_getfilename(globhandle, i), "\n");
-               f = search_getfilename(globhandle, i);
-               precache_playermodel(f);
+               string s = search_getfilename(globhandle, i);
+               precache_playermodel(s);
        }
        search_end(globhandle);
 }
 
 void precache_playermodels(string s)
 {
-       if(s != "")
-       {
-               int n = tokenize_console(s);
-               precache_playermodel(argv(0));
-
-               for (int i = 1; i < n; ++i)
-                       precache_model(argv(i));
-       }
+       FOREACH_WORD(s, true, LAMBDA(precache_playermodel(it)));
 }
 
 void precache()