]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
mapinfo: don't spam errors when there is no maps
authorRudolf Polzer <divverent@xonotic.org>
Thu, 27 Dec 2012 16:27:24 +0000 (17:27 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 27 Dec 2012 16:27:24 +0000 (17:27 +0100)
qcsrc/common/mapinfo.qc

index 05c93865dbcceed7c2606d9cb567b727e3fe8ad7..d29cc5d08897de3f792ae05919fd8863e0939f7e 100644 (file)
@@ -89,6 +89,8 @@ float _MapInfo_globhandle;
 string _MapInfo_GlobItem(float i)
 {
        string s;
+       if(!_MapInfo_globopen)
+               return string_null;
        s = search_getfilename(_MapInfo_globhandle, i);
        return substring(s, 5, strlen(s) - 9); // without maps/ and .bsp
 }
@@ -96,11 +98,19 @@ string _MapInfo_GlobItem(float i)
 void MapInfo_Enumerate()
 {
        if(_MapInfo_globopen)
+       {
                search_end(_MapInfo_globhandle);
+               _MapInfo_globopen = 0;
+       }
        MapInfo_Cache_Invalidate();
        _MapInfo_globhandle = search_begin("maps/*.bsp", TRUE, TRUE);
-       _MapInfo_globcount = search_getsize(_MapInfo_globhandle);
-       _MapInfo_globopen = 1;
+       if(_MapInfo_globhandle >= 0)
+       {
+               _MapInfo_globcount = search_getsize(_MapInfo_globhandle);
+               _MapInfo_globopen = 1;
+       }
+       else
+               _MapInfo_globcount = 0;
 }
 
 // filter the info by game type mask (updates MapInfo_count)