From: bones_was_here Date: Mon, 23 Oct 2023 23:28:23 +0000 (+1000) Subject: Fix GUI map voting with g_maplist_shuffle <= 0 && g_maplist_selectrandom 0 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=978b389f7810328d616ff4ceca1690ef51d90b53;p=xonotic%2Fxonotic-data.pk3dir.git Fix GUI map voting with g_maplist_shuffle <= 0 && g_maplist_selectrandom 0 MaplistMethod_Iterate() returned the same map every time because Map_Current wasn't updated. Documents g_maplist_shuffle -1. --- diff --git a/qcsrc/server/intermission.qc b/qcsrc/server/intermission.qc index f2e9cc53a..917eb8ce4 100644 --- a/qcsrc/server/intermission.qc +++ b/qcsrc/server/intermission.qc @@ -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; } diff --git a/xonotic-server.cfg b/xonotic-server.cfg index a72143db3..1478c737c 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -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"