From f701283bdb8b0b165062fb55edcd19f65895c270 Mon Sep 17 00:00:00 2001 From: puzl Date: Sun, 14 May 2006 15:52:53 +0000 Subject: [PATCH] Mantis: 0000798 o Added map name and round timer to scoreboard git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@484 67975925-1194-0748-b3d5-c16f83f1a3a1 --- .../3.2.0/source/cl_dll/vgui_ScorePanel.cpp | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/releases/3.2.0/source/cl_dll/vgui_ScorePanel.cpp b/releases/3.2.0/source/cl_dll/vgui_ScorePanel.cpp index 6debadc0..2d72a892 100644 --- a/releases/3.2.0/source/cl_dll/vgui_ScorePanel.cpp +++ b/releases/3.2.0/source/cl_dll/vgui_ScorePanel.cpp @@ -400,28 +400,32 @@ bool HACK_GetPlayerUniqueID( int iPlayer, char playerID[16] ) void ScorePanel::Update() { // Set the title - string theTitleName; + char title[128]; + char theServerName[MAX_SERVERNAME_LENGTH+1]; if (gViewPort->m_szServerName) { int iServerNameLength = max((int)strlen(gViewPort->m_szServerName),MAX_SERVERNAME_LENGTH); - theTitleName += string(gViewPort->m_szServerName,iServerNameLength); + sprintf(theServerName, "%32s", gViewPort->m_szServerName); } - string theMapName = gHUD.GetMapName(); - if(theMapName != "") - { - if(theTitleName != "") - { - theTitleName += " "; - } + char theMapName[MAX_MAPNAME_LENGTH+1]; + sprintf(theMapName, "%s", gHUD.GetMapName().c_str()); - theTitleName += "("; - theTitleName += theMapName; - theTitleName += ")"; + int theTimeElapsed = gHUD.GetGameTime(); + char elapsedString[64]; + if ( theTimeElapsed > 0 ) { + int theMinutesElapsed = theTimeElapsed/60; + int theSecondsElapsed = theTimeElapsed%60; + sprintf(elapsedString, "Game time: %d:%02d", theMinutesElapsed, theSecondsElapsed); + } + else { + sprintf(elapsedString, ""); } - m_TitleLabel.setText(theTitleName.c_str()); + sprintf(title, "%s Map: %s %s", theServerName, theMapName, elapsedString); + + m_TitleLabel.setText(title); int theColorIndex = 0;