mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
Fix #662 (timer command displays the wrong state)
This commit is contained in:
parent
7f407aa303
commit
e4345307c1
|
@ -1283,20 +1283,11 @@ void CGameContext::ConSetTimerType(IConsole::IResult *pResult, void *pUserData)
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const char msg[3][128] = {"game/round timer.", "broadcast.", "both game/round timer and broadcast."};
|
if(pResult->NumArguments() > 0)
|
||||||
char aBuf[128];
|
{
|
||||||
if(pPlayer->m_TimerType <= CPlayer::TIMERTYPE_GAMETIMER_AND_BROADCAST && pPlayer->m_TimerType >= CPlayer::TIMERTYPE_GAMETIMER)
|
|
||||||
str_format(aBuf, sizeof(aBuf), "Timer is displayed in %s", msg[pPlayer->m_TimerType]);
|
|
||||||
else if(pPlayer->m_TimerType == CPlayer::TIMERTYPE_NONE)
|
|
||||||
str_format(aBuf, sizeof(aBuf), "Timer isn't displayed.");
|
|
||||||
|
|
||||||
int OldType = pPlayer->m_TimerType;
|
int OldType = pPlayer->m_TimerType;
|
||||||
|
|
||||||
if(pResult->NumArguments() == 0) {
|
if(str_comp_nocase(pResult->GetString(0), "gametimer") == 0)
|
||||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD,"timer",aBuf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(str_comp_nocase(pResult->GetString(0), "gametimer") == 0)
|
|
||||||
{
|
{
|
||||||
if(pPlayer->m_ClientVersion >= VERSION_DDNET_GAMETICK)
|
if(pPlayer->m_ClientVersion >= VERSION_DDNET_GAMETICK)
|
||||||
pPlayer->m_TimerType = CPlayer::TIMERTYPE_GAMETIMER;
|
pPlayer->m_TimerType = CPlayer::TIMERTYPE_GAMETIMER;
|
||||||
|
@ -1337,6 +1328,14 @@ void CGameContext::ConSetTimerType(IConsole::IResult *pResult, void *pUserData)
|
||||||
|
|
||||||
if((OldType == CPlayer::TIMERTYPE_BROADCAST || OldType == CPlayer::TIMERTYPE_GAMETIMER_AND_BROADCAST) && (pPlayer->m_TimerType == CPlayer::TIMERTYPE_GAMETIMER || pPlayer->m_TimerType == CPlayer::TIMERTYPE_NONE))
|
if((OldType == CPlayer::TIMERTYPE_BROADCAST || OldType == CPlayer::TIMERTYPE_GAMETIMER_AND_BROADCAST) && (pPlayer->m_TimerType == CPlayer::TIMERTYPE_GAMETIMER || pPlayer->m_TimerType == CPlayer::TIMERTYPE_NONE))
|
||||||
pSelf->SendBroadcast("", pResult->m_ClientID);
|
pSelf->SendBroadcast("", pResult->m_ClientID);
|
||||||
|
}
|
||||||
|
|
||||||
|
char aBuf[128];
|
||||||
|
const char msg[3][128] = {"game/round timer.", "broadcast.", "both game/round timer and broadcast."};
|
||||||
|
if(pPlayer->m_TimerType <= CPlayer::TIMERTYPE_GAMETIMER_AND_BROADCAST && pPlayer->m_TimerType >= CPlayer::TIMERTYPE_GAMETIMER)
|
||||||
|
str_format(aBuf, sizeof(aBuf), "Timer is displayed in %s", msg[pPlayer->m_TimerType]);
|
||||||
|
else if(pPlayer->m_TimerType == CPlayer::TIMERTYPE_NONE)
|
||||||
|
str_format(aBuf, sizeof(aBuf), "Timer isn't displayed.");
|
||||||
|
|
||||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "timer", aBuf);
|
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "timer", aBuf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue