mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix afk timer not working.
This commit is contained in:
parent
28f4739e46
commit
0ecc50ae0f
|
@ -1612,7 +1612,7 @@ void CGameContext::OnClientConnected(int ClientID, void *pData)
|
|||
if(m_apPlayers[ClientID])
|
||||
delete m_apPlayers[ClientID];
|
||||
m_apPlayers[ClientID] = new(ClientID) CPlayer(this, NextUniqueClientID, ClientID, StartTeam);
|
||||
m_apPlayers[ClientID]->SetAfk(Afk);
|
||||
m_apPlayers[ClientID]->SetInitialAfk(Afk);
|
||||
NextUniqueClientID += 1;
|
||||
|
||||
#ifdef CONF_DEBUG
|
||||
|
|
|
@ -714,15 +714,21 @@ void CPlayer::AfkTimer()
|
|||
void CPlayer::SetAfk(bool Afk)
|
||||
{
|
||||
if(m_Afk != Afk)
|
||||
{
|
||||
Server()->ExpireServerInfo();
|
||||
m_Afk = Afk;
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::SetInitialAfk(bool Afk)
|
||||
{
|
||||
if(g_Config.m_SvMaxAfkTime == 0)
|
||||
{
|
||||
m_Afk = false;
|
||||
SetAfk(false);
|
||||
return;
|
||||
}
|
||||
|
||||
m_Afk = Afk;
|
||||
SetAfk(Afk);
|
||||
|
||||
// Ensure that the AFK state is not reset again automatically
|
||||
if(Afk)
|
||||
|
|
|
@ -193,6 +193,7 @@ public:
|
|||
void UpdatePlaytime();
|
||||
void AfkTimer();
|
||||
void SetAfk(bool Afk);
|
||||
void SetInitialAfk(bool Afk);
|
||||
bool IsAfk() const { return m_Afk; }
|
||||
|
||||
int64_t m_LastPlaytime;
|
||||
|
|
Loading…
Reference in a new issue