From: Dr. Jaska Date: Fri, 19 May 2023 12:50:30 +0000 (+0000) Subject: Fix #2443 "Map voting countdown continues even when all players have selected 'don... X-Git-Tag: xonotic-v0.8.6~103^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f6645f49d8bb776ce5775e0c2ca066a6bb9f3573;p=xonotic%2Fxonotic-data.pk3dir.git Fix #2443 "Map voting countdown continues even when all players have selected 'don't care'" and the first votable option always being picked when `sv_vote_gametype_default_current` == 1 instead of a random map even though someone voted for abstain. --- diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index a4e68e7da..a942cbf2a 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -473,7 +473,7 @@ bool MapVote_Finished(int mappos) { if ( GameTypeVote_Finished(mappos) ) { - gametypevote = false; + gametypevote = 0; if(autocvar_nextmap != "") { Map_Goto_SetStr(autocvar_nextmap); @@ -536,14 +536,14 @@ bool MapVote_CheckRules_2() if ( mapvote_maps_flags[i] & GTV_AVAILABLE ) { RandomSelection_AddFloat(i, 1, mapvote_selections[i]); - if ( gametypevote && mapvote_maps[i] == MapInfo_Type_ToString(MapInfo_CurrentGametype()) ) + if ( gametypevote && mapvote_maps[i] == MapInfo_Type_ToString(MapInfo_CurrentGametype()) ) { currentVotes = mapvote_selections[i]; currentPlace = i; } } firstPlaceVotes = RandomSelection_best_priority; - if ( autocvar_sv_vote_gametype_default_current && firstPlaceVotes == 0 ) + if (gametypevote && autocvar_sv_vote_gametype_default_current && firstPlaceVotes == 0) firstPlace = currentPlace; else firstPlace = RandomSelection_chosen_float; @@ -564,8 +564,12 @@ bool MapVote_CheckRules_2() if(firstPlace == -1) error("No first place in map vote... WTF?"); - if(secondPlace == -1 || time > mapvote_timeout || (mapvote_voters_real - firstPlaceVotes) < firstPlaceVotes) + if(secondPlace == -1 || time > mapvote_timeout + || (mapvote_voters_real - firstPlaceVotes) < firstPlaceVotes + || mapvote_selections[mapvote_count - 1] == mapvote_voters) + { return MapVote_Finished(firstPlace); + } if(mapvote_keeptwotime) if(time > mapvote_keeptwotime || (mapvote_voters_real - firstPlaceVotes - secondPlaceVotes) < secondPlaceVotes)