Skip to content

Commit

Permalink
Properly handle ties
Browse files Browse the repository at this point in the history
  • Loading branch information
TomyLobo committed Oct 7, 2016
1 parent 229a4de commit be4ded1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mp/src/game/server/vote_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,6 @@ int CVoteController::GetWinningVoteOption( void )
else
{
// Which option had the most votes?
// driller: Need to handle ties
int nHighest = m_nVoteOptionCount[0];
m_nHighestCountIndex = 0;
for ( int iIndex = 0; iIndex < m_nVoteOptionCount.Count(); iIndex ++ )
Expand All @@ -780,6 +779,11 @@ int CVoteController::GetWinningVoteOption( void )
nHighest = m_nVoteOptionCount[iIndex];
m_nHighestCountIndex = iIndex;
}
else if (nHighest == m_nVoteOptionCount[iIndex])
{
// We have a tie => reset index
m_nHighestCountIndex = -1;
}
}

return m_nHighestCountIndex;
Expand Down

0 comments on commit be4ded1

Please sign in to comment.