X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmapinfo.qc;h=f7ced420579acb32837ea61f04511d39ddac86f5;hb=c62a8010ce4cfc8ef8b107be5544ba58335b8967;hp=1b32c9d1d5a076c3825f5ea9900522282f7abd40;hpb=5fab88f2b713eb8f20a7296a20f57f6dfafd220d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 1b32c9d1d..f7ced4205 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -38,7 +38,7 @@ void MapInfo_Cache_Store() 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)); @@ -65,7 +65,7 @@ float MapInfo_Cache_Retrieve(string map) return 0; s = db_get(_MapInfo_Cache_DB_NameToIndex, map); - if(!s) + if(s == "") return 0; i = stof(s); @@ -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) @@ -242,6 +252,8 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp spawnpoints = 0; spawnplaces = 0; _MapInfo_Map_worldspawn_music = ""; + mapMins = '0 0 0'; + mapMaxs = '0 0 0'; for(;;) { @@ -536,7 +548,7 @@ string _MapInfo_GetDefaultEx(float t) { entity e; for(e = MapInfo_Type_first; e; e = e.enemy) - if(t == e.weapons) + if(t == e.items) return e.model2; return ""; } @@ -637,11 +649,29 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType) float MapInfo_Type_FromString(string t) { entity e; + if(t == "nexball") + { + print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t); + t = "nb"; + print("'. Should use '", t, "'.\n"); + } + if(t == "freezetag") + { + print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t); + t = "ft"; + print("'. Should use '", t, "'.\n"); + } + if(t == "keepaway") + { + print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t); + t = "ka"; + print("'. Should use '", t, "'.\n"); + } if(t == "all") return MAPINFO_TYPE_ALL; for(e = MapInfo_Type_first; e; e = e.enemy) if(t == e.mdl) - return e.weapons; + return e.items; return 0; } @@ -651,7 +681,7 @@ string MapInfo_Type_ToString(float t) if(t == MAPINFO_TYPE_ALL) return "all"; for(e = MapInfo_Type_first; e; e = e.enemy) - if(t == e.weapons) + if(t == e.items) return e.mdl; return ""; } @@ -660,7 +690,7 @@ string MapInfo_Type_ToText(float t) { entity e; for(e = MapInfo_Type_first; e; e = e.enemy) - if(t == e.weapons) + if(t == e.items) return e.message; return _("@!#%'n Tuba Throwing"); } @@ -925,7 +955,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo 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; @@ -1157,8 +1187,8 @@ float MapInfo_CurrentGametype() prev = cvar("gamecfg"); for(e = MapInfo_Type_first; e; e = e.enemy) if(cvar(e.netname)) - if(prev != e.weapons) - return e.weapons; + if(prev != e.items) + return e.items; if(prev) return prev; return MAPINFO_TYPE_DEATHMATCH; @@ -1187,7 +1217,7 @@ void MapInfo_SwitchGameType(float t) { entity e; for(e = MapInfo_Type_first; e; e = e.enemy) - cvar_set(e.netname, (t == e.weapons) ? "1" : "0"); + cvar_set(e.netname, (t == e.items) ? "1" : "0"); } void MapInfo_LoadMap(string s, float reinit)