fixing runoff votes as sometimes they did happen despite a map receiving over 51% of votes

This commit is contained in:
jenz 2023-10-10 00:11:30 +02:00
parent 1de17daf48
commit 8c673f4401

View File

@ -1643,9 +1643,9 @@ public void Handler_MapVoteFinished(Handle menu,
// Implement revote logic - Only run this` block if revotes are enabled and this isn't the last revote'
//LogMessage("Mapchooser_extended_avg Handler_MapVoteFinished.");
int required_percent = GetConVarInt(g_Cvar_RunOffPercent);
int required_votes = RoundToCeil((total_votes * float(required_percent)) / 100.0);
int most_voted_map_percentage = RoundToFloor((weighted_votes[0] / total_votes) * 100);
if(GetConVarBool(g_Cvar_RunOff) && g_RunoffCount < GetConVarInt(g_Cvar_MaxRunOffs) && num_items > 1 &&
(weighted_votes[0] == weighted_votes[1] || weighted_votes[0] < required_votes))
(weighted_votes[0] == weighted_votes[1] || most_voted_map_percentage < required_percent))
{
//LogMessage("Mapchooser_extended_avg Handler_MapVoteFinished passed check1.");
g_RunoffCount++;
@ -1673,7 +1673,7 @@ public void Handler_MapVoteFinished(Handle menu,
SetupWarningTimer(WarningType_Revote, view_as<MapChange>(g_ChangeTime), mapList);
return;
}
else if(weighted_votes[0] < required_votes)
else if(most_voted_map_percentage < required_percent)
{
g_HasVoteStarted = false;