]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix #2443 "Map voting countdown continues even when all players have selected 'don...
authorDr. Jaska <drjaska83@gmail.com>
Fri, 19 May 2023 12:50:30 +0000 (12:50 +0000)
committerterencehill <piuntn@gmail.com>
Fri, 19 May 2023 12:50:30 +0000 (12:50 +0000)
qcsrc/server/mapvoting.qc

index a4e68e7da7bd3e9b5766c30925b54434a7d52b85..a942cbf2ac34893c98d6f15eed562926a6b3c600 100644 (file)
@@ -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)