Do not force scoreboard open when the game is paused

If the game is paused and a player joins a server (sv_tournament_mode 0)
The scoreboard will be forced open. Unless the client configured cl_scoreboard_on_death 0.

This can be quite annoying. Especially in the brand new 0.7 feature
where users can pause the game. Oy realized that this is a problem 12
year ago:

aec468a3c4 (diff-e0ff7a1d6079610adb64fc89fbfff23a381ed92f268d8fe188731a9e0c323b0aR389-R390)

For ddnet servers this would mostly affect tournaments where paused games are
used to give everyone enough time to download the map.

A open scoreboard also blocks broadcasts. So new users might miss the
admin announcements explaining why the game is paused.
This commit is contained in:
ChillerDragon 2024-09-04 10:07:01 +08:00
parent 51c0b4dafc
commit 74bb327799

View file

@ -797,15 +797,16 @@ bool CScoreboard::Active() const
if(m_Active) if(m_Active)
return true; return true;
const CNetObj_GameInfo *pGameInfoObj = GameClient()->m_Snap.m_pGameInfoObj;
if(GameClient()->m_Snap.m_pLocalInfo && !GameClient()->m_Snap.m_SpecInfo.m_Active) if(GameClient()->m_Snap.m_pLocalInfo && !GameClient()->m_Snap.m_SpecInfo.m_Active)
{ {
// we are not a spectator, check if we are dead // we are not a spectator, check if we are dead and the game isn't paused
if(!GameClient()->m_Snap.m_pLocalCharacter && g_Config.m_ClScoreboardOnDeath) if(!GameClient()->m_Snap.m_pLocalCharacter && g_Config.m_ClScoreboardOnDeath &&
!(pGameInfoObj && pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_PAUSED))
return true; return true;
} }
// if the game is over // if the game is over
const CNetObj_GameInfo *pGameInfoObj = GameClient()->m_Snap.m_pGameInfoObj;
if(pGameInfoObj && pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_GAMEOVER) if(pGameInfoObj && pGameInfoObj->m_GameStateFlags & GAMESTATEFLAG_GAMEOVER)
return true; return true;