]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapinfo.qc
Merge branch 'Mario/q3compat_sanity' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapinfo.qc
index ca90f2f33e1f2fe1f31b26698985b9308cd37c54..c2b15729578d9353e82cd822b7005db7ebd4da1e 100644 (file)
@@ -1344,6 +1344,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