1529: Don't enforce own votes when moderating r=def- a=12pm

It's counterintuitive, and hence way too risky

Co-authored-by: 12pm <30786226+12pm@users.noreply.github.com>
This commit is contained in:
bors[bot] 2019-03-21 06:24:12 +00:00
commit 23269c3ac4

View file

@ -792,26 +792,6 @@ void CGameContext::OnTick()
else if(ActVote < 0) else if(ActVote < 0)
VetoStop = true; VetoStop = true;
} }
// Check if an active moderator has voted.
if (m_apPlayers[i] && m_apPlayers[i]->m_Vote != 0 && m_apPlayers[i]->m_Moderating)
{
if (m_apPlayers[i]->m_Vote == 1)
{
Server()->SetRconCID(IServer::RCON_CID_VOTE);
Console()->ExecuteLine(m_aVoteCommand);
Server()->SetRconCID(IServer::RCON_CID_SERV);
EndVote();
SendChat(-1, CGameContext::CHAT_ALL, "Vote passed enforced by authorized player");
return;
}
else if (m_apPlayers[i]->m_Vote == -1)
{
EndVote();
SendChat(-1, CGameContext::CHAT_ALL, "Vote failed enforced by authorized player");
return;
}
}
} }
if(g_Config.m_SvVoteMaxTotal && Total > g_Config.m_SvVoteMaxTotal && if(g_Config.m_SvVoteMaxTotal && Total > g_Config.m_SvVoteMaxTotal &&
@ -832,12 +812,9 @@ void CGameContext::OnTick()
if(time_get() > m_VoteCloseTime && !g_Config.m_SvVoteMajority) if(time_get() > m_VoteCloseTime && !g_Config.m_SvVoteMajority)
m_VoteEnforce = (m_VoteWillPass && !Veto) ? VOTE_ENFORCE_YES : VOTE_ENFORCE_NO; m_VoteEnforce = (m_VoteWillPass && !Veto) ? VOTE_ENFORCE_YES : VOTE_ENFORCE_NO;
if(m_VoteEnforce == VOTE_ENFORCE_YES) // / Ensure minimum time for vote to end when moderating.
{ if(m_VoteEnforce == VOTE_ENFORCE_YES && !(PlayerModerating() &&
if(PlayerModerating() && (m_VoteKick || m_VoteSpec)) (m_VoteKick || m_VoteSpec) && time_get() < m_VoteCloseTime))
{
// Ensure minimum time for vote to end when moderating.
if(time_get() > m_VoteCloseTime)
{ {
Server()->SetRconCID(IServer::RCON_CID_VOTE); Server()->SetRconCID(IServer::RCON_CID_VOTE);
Console()->ExecuteLine(m_aVoteCommand); Console()->ExecuteLine(m_aVoteCommand);
@ -848,19 +825,6 @@ void CGameContext::OnTick()
if(m_apPlayers[m_VoteCreator] && !m_VoteKick && !m_VoteSpec) if(m_apPlayers[m_VoteCreator] && !m_VoteKick && !m_VoteSpec)
m_apPlayers[m_VoteCreator]->m_LastVoteCall = 0; m_apPlayers[m_VoteCreator]->m_LastVoteCall = 0;
} }
}
else
{
Server()->SetRconCID(IServer::RCON_CID_VOTE);
Console()->ExecuteLine(m_aVoteCommand);
Server()->SetRconCID(IServer::RCON_CID_SERV);
EndVote();
SendChat(-1, CGameContext::CHAT_ALL, "Vote passed");
if(m_apPlayers[m_VoteCreator] && !m_VoteKick && !m_VoteSpec)
m_apPlayers[m_VoteCreator]->m_LastVoteCall = 0;
}
}
else if(m_VoteEnforce == VOTE_ENFORCE_YES_ADMIN) else if(m_VoteEnforce == VOTE_ENFORCE_YES_ADMIN)
{ {
char aBuf[64]; char aBuf[64];