]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix GUI map voting with g_maplist_shuffle <= 0 && g_maplist_selectrandom 0
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 23 Oct 2023 23:28:23 +0000 (09:28 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 10 Feb 2024 08:16:58 +0000 (18:16 +1000)
MaplistMethod_Iterate() returned the same map every time because
Map_Current wasn't updated.

Documents g_maplist_shuffle -1.

qcsrc/server/intermission.qc
xonotic-server.cfg

index f2e9cc53a816f538f23bec35d08e336a99f08cf4..917eb8ce44b18901b3704e7226cf3bfaf99ea1dd 100644 (file)
@@ -154,6 +154,7 @@ void Map_Goto_SetStr(string nextmapname)
 
 void Map_Goto_SetIndex(int position)
 {
+       Map_Current = position;
        cvar_set("g_maplist_index", ftos(position));
        Map_Goto_SetStr(argv(position));
 }
@@ -254,9 +255,8 @@ int MaplistMethod_Shuffle(float exponent) // more clever shuffling
                Map_Count = tokenizebyseparator(autocvar_g_maplist, " ");
 
                // NOTE: the selected map has just been inserted at (insertpos-1)th position
-               Map_Current = insertpos - 1; // this is not really valid, but this way the fallback has a chance of working
-               if(Map_Check(Map_Current, 1))
-                       return Map_Current;
+               if (Map_Check(insertpos - 1, 1))
+                       return insertpos - 1;
        }
        return -1;
 }
index a72143db3849a387a10fad28f8440f6816600081..1478c737c04a3d5d29b399208ed32aae571c09a5 100644 (file)
@@ -226,7 +226,7 @@ set g_maplist_mostrecent "" "contains the name of the maps that were most recent
 set g_maplist_mostrecent_count 3 "number of most recent maps that are blocked from being played again"
 set g_maplist_index 0 "this is used internally for saving position in maplist cycle"
 set g_maplist_selectrandom 0 "if 1, a random map will be chosen as next map - DEPRECATED in favor of g_maplist_shuffle"
-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_shuffle 1 "1: shuffling method which avoids playing the same maps in short succession by taking out the first element and inserting it into g_maplist with a bias to the end of the list. -1: a simpler shuffling method which should be adequate if g_maplist_mostrecent_count is large enough."
 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"