X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Fmapinfo.qc;h=82a7e758413de31ffd73eae094b93717c67fb678;hb=b9515b59597aae19247d1b012c68c26049d44c4b;hp=24d7f4dfa1870c9e82a773ab7f9847bbf4ae06a5;hpb=645ad832deb8670591332a4f84b13d7a7405a3f5;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 24d7f4dfa..82a7e7584 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -906,7 +906,7 @@ bool _MapInfo_ParseArena(string arena_filename, int fh, string pFilename, Gamety string types = s; types = strreplace("team", "tdm ft", types); types = strreplace("ffa", "dm lms ka", types); - if(strstrofs(s, "tournament", 0) < 0 && strstrofs(s, "tdm", 0) >= 0) // larger team map, support additional gamemodes! + if(strstrofs(types, "tournament", 0) < 0 && strstrofs(types, "tdm", 0) >= 0) // larger team map, support additional gamemodes! types = cons(types, "ca kh"); FOREACH_WORD(types, true, { @@ -935,9 +935,6 @@ bool _MapInfo_ParseArena(string arena_filename, int fh, string pFilename, Gamety return false; } -#if defined(CSQC) || defined(MENUQC) -string(string filename) whichpack = #503; -#endif string _MapInfo_CheckArenaFile(string pFilename, string pMapname) { // returns the file name if valid, otherwise returns "" @@ -1344,6 +1341,23 @@ int MapInfo_Get_ByName(string pFilename, float pAllowGenerate, Gametype pGametyp return r; } +bool MapReadSizes(string map) +{ + // TODO: implement xonotic#28 / xonvote 172 (sizes in mapinfo) + string readsize_msg = strcat("MapReadSizes ", map); + float fh = fopen(strcat("maps/", map, ".sizes"), FILE_READ); + if(fh >= 0) + { + map_minplayers = stoi(fgets(fh)); + map_maxplayers = stoi(fgets(fh)); + fclose(fh); + LOG_TRACEF(readsize_msg, ": ok, min %d max %d", map_minplayers, map_maxplayers); + return true; + } + LOG_TRACE(readsize_msg, ": not found"); + return false; +} + float MapInfo_FindName(string s) { // if there is exactly one map of prefix s, return it