From 605ba4c6e90d84d0b84f7314fda01779391c25bf Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 27 Dec 2012 17:27:24 +0100 Subject: [PATCH] mapinfo: don't spam errors when there is no maps --- qcsrc/common/mapinfo.qc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 05c93865d..d29cc5d08 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -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) -- 2.39.2