mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #7262 from furo321/expire-server-info-afk
Expire server info when changing `m_Afk`
This commit is contained in:
commit
6a030e1a2b
|
@ -219,7 +219,7 @@ void CPlayer::Tick()
|
|||
|
||||
if(Server()->GetNetErrorString(m_ClientID)[0])
|
||||
{
|
||||
m_Afk = true;
|
||||
SetAfk(true);
|
||||
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' would have timed out, but can use timeout protection now", Server()->ClientName(m_ClientID));
|
||||
|
@ -705,11 +705,14 @@ void CPlayer::UpdatePlaytime()
|
|||
|
||||
void CPlayer::AfkTimer()
|
||||
{
|
||||
m_Afk = g_Config.m_SvMaxAfkTime != 0 && m_LastPlaytime < time_get() - time_freq() * g_Config.m_SvMaxAfkTime;
|
||||
SetAfk(g_Config.m_SvMaxAfkTime != 0 && m_LastPlaytime < time_get() - time_freq() * g_Config.m_SvMaxAfkTime);
|
||||
}
|
||||
|
||||
void CPlayer::SetAfk(bool Afk)
|
||||
{
|
||||
if(m_Afk != Afk)
|
||||
Server()->ExpireServerInfo();
|
||||
|
||||
if(g_Config.m_SvMaxAfkTime == 0)
|
||||
{
|
||||
m_Afk = false;
|
||||
|
|
Loading…
Reference in a new issue