From 813f0797d8b47135df3c4448bf4df3272bdc12d7 Mon Sep 17 00:00:00 2001 From: oy Date: Mon, 17 Jan 2011 13:42:40 +0100 Subject: [PATCH] fixed scoreboard active check. Closes #423 --- src/game/client/components/scoreboard.cpp | 39 ++++++++++------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index 5fb2395fc..afc87ef8d 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -265,24 +265,7 @@ void CScoreboard::RenderRecordingNotification(float x) void CScoreboard::OnRender() { - bool DoScoreBoard = false; - - // if we activly wanna look on the scoreboard - if(m_Active) - DoScoreBoard = true; - - if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS) - { - // we are not a spectator, check if we are ead - if(!m_pClient->m_Snap.m_pLocalCharacter || m_pClient->m_Snap.m_pLocalCharacter->m_Health < 0) - DoScoreBoard = true; - } - - // if we the game is over - if(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver) - DoScoreBoard = true; - - if(!DoScoreBoard) + if(!Active()) return; // if the score board is active, then we should clear the motd message aswell @@ -298,10 +281,7 @@ void CScoreboard::OnRender() float w = 650.0f; if(m_pClient->m_Snap.m_pGameobj && !(m_pClient->m_Snap.m_pGameobj->m_Flags&GAMEFLAG_TEAMS)) - { RenderScoreboard(Width/2-w/2, 150.0f, w, 0, 0); - //render_scoreboard(gameobj, 0, 0, -1, 0); - } else { @@ -328,5 +308,20 @@ void CScoreboard::OnRender() bool CScoreboard::Active() { - return m_Active | (m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver); + // if we activly wanna look on the scoreboard + if(m_Active) + return true; + + if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS) + { + // we are not a spectator, check if we are dead + if(!m_pClient->m_Snap.m_pLocalCharacter || m_pClient->m_Snap.m_pLocalCharacter->m_Health <= 0) + return true; + } + + // if the game is over + if(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver) + return true; + + return false; }