]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Check the player limit when getting player count to ensure forced spectators don...
authorMario <mario.mario@y7mail.com>
Fri, 22 May 2020 11:00:49 +0000 (21:00 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 22 May 2020 11:00:49 +0000 (21:00 +1000)
qcsrc/server/autocvars.qh
qcsrc/server/g_world.qc
xonotic-server.cfg

index 6aa798afb9b8b823f6363a914cde396fb165d55f..79989cc176d1a3e70200cd3fe03f60da91458817 100644 (file)
@@ -159,6 +159,7 @@ bool autocvar_g_maplist_votable_suggestions;
 bool autocvar_g_maplist_votable_suggestions_override_mostrecent;
 float autocvar_g_maplist_votable_timeout;
 bool autocvar_g_maplist_ignore_sizes;
+bool autocvar_g_maplist_sizes_count_maxplayers = true;
 bool autocvar_g_maplist_sizes_count_bots = true;
 int autocvar_g_maxplayers;
 float autocvar_g_maxplayers_spectator_blocktime;
index 8f131b745c8782c077e84cfef4641e1b4e12f8b1..c626b52f8f3b1a4d47bb11d48a60bbaeb2cf2635 100644 (file)
@@ -1072,7 +1072,8 @@ bool MapHasRightSize(string map)
        // open map size restriction file
        string opensize_msg = strcat("opensize ", map);
        float fh = fopen(strcat("maps/", map, ".sizes"), FILE_READ);
-       int pcount = player_count;
+       int player_limit = ((autocvar_g_maplist_sizes_count_maxplayers) ? GetPlayerLimit() : 0);
+       int pcount = ((player_limit > 0) ? min(player_count, player_limit) : player_count); // bind it to the player limit so that forced spectators don't influence the limits
        if(!autocvar_g_maplist_sizes_count_bots)
                pcount -= currentbots;
        if(fh >= 0)
index 4fd599567007c6f55371e22293be76c4cca36ed1..d4a97d7da54f872b631665fe9c0fad750faf00c2 100644 (file)
@@ -220,6 +220,7 @@ set g_maplist_selectrandom 0 "if 1, a random map will be chosen as next map - DE
 set g_maplist_shuffle 1 "new randomization method: like selectrandom, but avoid playing the same maps in short succession. This works by taking out the first element and inserting it into g_maplist with a bias to the end of the list"
 set g_maplist_check_waypoints 0 "when 1, maps are skipped if there currently are bots, but the map has no waypoints"
 set g_maplist_ignore_sizes 0 "when 1, all maps are shown in the map list regardless of player count"
+set g_maplist_sizes_count_maxplayers 1 "check the player limit when getting the player count so forced spectators don't affect the size restrictions"
 set g_maplist_sizes_count_bots 1 "include the number of bots currently in the server when counting the number of players for size restrictions"
 
 set g_items_mindist 4000 "starting distance for the fading of items"