1168: More style fixes r=Learath2 a=heinrich5991



Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
bors[bot] 2018-06-24 14:02:59 +00:00
commit a4833dd7f4
2 changed files with 17 additions and 16 deletions

View file

@ -551,22 +551,21 @@ void CGameContext::ConModerate(IConsole::IResult *pResult, void *pUserData)
bool HadModerator = pSelf->PlayerModerating();
CPlayer* player = pSelf->m_apPlayers[pResult->m_ClientID];
player->m_Moderating = !player->m_Moderating;
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID];
pPlayer->m_Moderating = !pPlayer->m_Moderating;
char aBuf[256];
if(!HadModerator && player->m_Moderating)
if(!HadModerator && pPlayer->m_Moderating)
str_format(aBuf, sizeof(aBuf), "Server kick/spec votes will now be actively moderated.");
if (!pSelf->PlayerModerating())
if(!pSelf->PlayerModerating())
str_format(aBuf, sizeof(aBuf), "Server kick/spec votes are no longer actively moderated.");
pSelf->SendChat(-1, CHAT_ALL, aBuf, 0);
if(player->m_Moderating)
pSelf->SendChatTarget(pResult->m_ClientID,
"Active moderator mode enabled for you.");
if(pPlayer->m_Moderating)
pSelf->SendChatTarget(pResult->m_ClientID, "Active moderator mode enabled for you.");
else
pSelf->SendChatTarget(pResult->m_ClientID, "Active moderator mode disabled for you.");
}

View file

@ -823,10 +823,10 @@ void CGameContext::OnTick()
if(m_VoteEnforce == VOTE_ENFORCE_YES)
{
if (PlayerModerating() && (m_VoteKick || m_VoteSpec))
if(PlayerModerating() && (m_VoteKick || m_VoteSpec))
{
// Ensure minimum time for vote to end when moderating.
if (time_get() > m_VoteCloseTime)
if(time_get() > m_VoteCloseTime)
{
Server()->SetRconCID(IServer::RCON_CID_VOTE);
Console()->ExecuteLine(m_aVoteCommand);
@ -834,7 +834,7 @@ void CGameContext::OnTick()
EndVote();
SendChat(-1, CGameContext::CHAT_ALL, "Vote passed");
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;
}
}
@ -846,7 +846,7 @@ void CGameContext::OnTick()
EndVote();
SendChat(-1, CGameContext::CHAT_ALL, "Vote passed");
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;
}
}
@ -3517,8 +3517,10 @@ int CGameContext::GetClientVersion(int ClientID) {
: 0;
}
void CGameContext::SetClientVersion(int ClientID, int Version) {
if (!m_apPlayers[ClientID]) {
void CGameContext::SetClientVersion(int ClientID, int Version)
{
if(!m_apPlayers[ClientID])
{
return;
}
m_apPlayers[ClientID]->m_ClientVersion = Version;
@ -3526,9 +3528,9 @@ void CGameContext::SetClientVersion(int ClientID, int Version) {
bool CGameContext::PlayerModerating()
{
for (int i = 0; i < MAX_CLIENTS; i++)
for(int i = 0; i < MAX_CLIENTS; i++)
{
if (m_apPlayers[i] && m_apPlayers[i]->m_Moderating)
if(m_apPlayers[i] && m_apPlayers[i]->m_Moderating)
return true;
}
return false;