return;
s = db_get(_MapInfo_Cache_DB_NameToIndex, MapInfo_Map_bspname);
- if(!s) // empty string is NOT valid here!
+ if(s == "")
{
i = buf_getsize(_MapInfo_Cache_Buf_IndexToMapData);
db_put(_MapInfo_Cache_DB_NameToIndex, MapInfo_Map_bspname, ftos(i));
return 0;
s = db_get(_MapInfo_Cache_DB_NameToIndex, map);
- if(!s)
+ if(s == "")
return 0;
i = stof(s);
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
}
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)
MapInfo_Map_author = s;
else if(t == "has")
{
- t = car(s); s = cdr(s);
+ t = car(s); // s = cdr(s);
if (t == "weapons") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS;
else if(t == "turrets") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_TURRETS;
else if(t == "vehicles") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_VEHICLES;