Skip to content

Commit f6fcc6c

Browse files
authored
Merge pull request ddnet#10466 from ChillerDragon/pr_vote_getter
Add IsRunningVote getter
2 parents 6e5fdc6 + 3a9383e commit f6fcc6c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/game/server/ddracechat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ void CGameContext::AttemptJoinTeam(int ClientId, int Team)
11431143
if(!pPlayer)
11441144
return;
11451145

1146-
if(m_VoteCloseTime && m_VoteCreator == ClientId && (IsKickVote() || IsSpecVote()))
1146+
if(IsRunningKickOrSpecVote(ClientId))
11471147
{
11481148
Console()->Print(
11491149
IConsole::OUTPUT_LEVEL_STANDARD,

src/game/server/gamecontext.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2854,7 +2854,7 @@ void CGameContext::OnKillNetMessage(const CNetMsg_Cl_Kill *pMsg, int ClientId)
28542854
if(m_World.m_Paused)
28552855
return;
28562856

2857-
if(m_VoteCloseTime && m_VoteCreator == ClientId && GetDDRaceTeam(ClientId) && (IsKickVote() || IsSpecVote()))
2857+
if(IsRunningKickOrSpecVote(ClientId) && GetDDRaceTeam(ClientId))
28582858
{
28592859
SendChatTarget(ClientId, "You are running a vote please try again after the vote is done!");
28602860
return;
@@ -4558,6 +4558,16 @@ void CGameContext::OnSetAuthed(int ClientId, int Level)
45584558
}
45594559
}
45604560

4561+
bool CGameContext::IsRunningVote(int ClientId) const
4562+
{
4563+
return m_VoteCloseTime && m_VoteCreator == ClientId;
4564+
}
4565+
4566+
bool CGameContext::IsRunningKickOrSpecVote(int ClientId) const
4567+
{
4568+
return IsRunningVote(ClientId) && (IsKickVote() || IsSpecVote());
4569+
}
4570+
45614571
void CGameContext::SendRecord(int ClientId)
45624572
{
45634573
CNetMsg_Sv_Record Msg;

src/game/server/gamecontext.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,9 @@ class CGameContext : public IGameServer
616616
inline bool IsKickVote() const { return m_VoteType == VOTE_TYPE_KICK; }
617617
inline bool IsSpecVote() const { return m_VoteType == VOTE_TYPE_SPECTATE; }
618618

619+
bool IsRunningVote(int ClientId) const;
620+
bool IsRunningKickOrSpecVote(int ClientId) const;
621+
619622
void SendRecord(int ClientId);
620623
void SendFinish(int ClientId, float Time, float PreviousBestTime);
621624
void OnSetAuthed(int ClientId, int Level) override;

0 commit comments

Comments
 (0)