From 7d462b565d6f509be8f05c97910edd3546e203f6 Mon Sep 17 00:00:00 2001 From: GreYFoX Date: Fri, 30 Dec 2011 16:31:06 +0200 Subject: [PATCH] Fixed the bugs i know of with the last few commits --- src/game/client/components/scoreboard.cpp | 7 +++---- src/game/server/ddracechat.cpp | 16 ++++++++-------- src/game/server/ddracechat.h | 2 +- src/game/server/entities/character.cpp | 2 +- src/game/server/player.cpp | 3 +-- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index edc1c9ced..9198d66bc 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -203,7 +203,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch Spacing = 8.0f; } - float ScoreOffset = x+10.0f, ScoreLength = TextRender()->TextWidth(0, 22.0f/*HeadlineFontsize*/, Localize("00:00.00"), -1); + float ScoreOffset = x+10.0f, ScoreLength = TextRender()->TextWidth(0, 22.0f/*HeadlineFontsize*/, "00:00:0", -1); float TeeOffset = ScoreOffset+ScoreLength, TeeLength = 60*TeeSizeMod; float NameOffset = TeeOffset+TeeLength, NameLength = 300.0f-TeeLength; float PingOffset = x+610.0f, PingLength = 65.0f; @@ -250,9 +250,8 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch // score if(m_IsGameTypeRace && g_Config.m_ClDDRaceScoreBoard) { - int Time = pInfo->m_Score < 0 ? 0 : pInfo->m_Score; - dbg_msg("Time", "%s, %d, %d", m_pClient->m_aClients[pInfo->m_ClientID].m_aName, Time, pInfo->m_Score); - str_format(aBuf, sizeof(aBuf), "%02d:%02d.%02d", Time/6000, Time/100-(Time/6000*60), Time % 100); + int Time = pInfo->m_Score == -9999 ? 0 : abs(pInfo->m_Score); + str_format(aBuf, sizeof(aBuf), "%02d:%02d", Time/60, Time%60); } else str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Score, -999, 999)); diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 394f1677d..21a7f100c 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -626,11 +626,11 @@ void CGameContext::ConSetEyeEmote(IConsole::IResult *pResult, "You don't have any eye emotes, remember to bind some. (until you die)"); return; } - else if(str_comp_nocase(pResult->GetString(0), "on")) + else if(str_comp_nocase(pResult->GetString(0), "on") == 0) pPlayer->m_EyeEmote = true; - else if(str_comp_nocase(pResult->GetString(0), "off")) + else if(str_comp_nocase(pResult->GetString(0), "off") == 0) pPlayer->m_EyeEmote = false; - else if(str_comp_nocase(pResult->GetString(0), "toggle")) + else if(str_comp_nocase(pResult->GetString(0), "toggle") == 0) pPlayer->m_EyeEmote = !pPlayer->m_EyeEmote; pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, @@ -831,11 +831,11 @@ void CGameContext::ConSetBroadcastTime(IConsole::IResult *pResult, void *pUserDa "Time will not be displayed in broadcast now"); return; } - else if(str_comp_nocase(pResult->GetString(0), "on")) + else if(str_comp_nocase(pResult->GetString(0), "on") == 0) pPlayer->m_BroadcastTime = true; - else if(str_comp_nocase(pResult->GetString(0), "off")) + else if(str_comp_nocase(pResult->GetString(0), "off") == 0) pPlayer->m_BroadcastTime = false; - else if(str_comp_nocase(pResult->GetString(0), "toggle")) + else if(str_comp_nocase(pResult->GetString(0), "toggle") == 0) pPlayer->m_BroadcastTime = !pPlayer->m_BroadcastTime; pSelf->Console()->Print( @@ -864,9 +864,9 @@ void CGameContext::ConSetServerGameTime(IConsole::IResult *pResult, void *pUserD "Time will not be displayed in broadcast now"); return; } - else if(str_comp_nocase(pResult->GetString(0), "on")) + else if(str_comp_nocase(pResult->GetString(0), "on") == 0) pPlayer->m_GameTimerTime = true; - else if(str_comp_nocase(pResult->GetString(0), "off")) + else if(str_comp_nocase(pResult->GetString(0), "off") == 0) pPlayer->m_GameTimerTime = false; else if(str_comp_nocase(pResult->GetString(0), "toggle")) pPlayer->m_GameTimerTime = !pPlayer->m_GameTimerTime; diff --git a/src/game/server/ddracechat.h b/src/game/server/ddracechat.h index 660ff4d40..9bf8bb9c9 100644 --- a/src/game/server/ddracechat.h +++ b/src/game/server/ddracechat.h @@ -23,7 +23,7 @@ CHAT_COMMAND("saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Priv CHAT_COMMAND("saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race") CHAT_COMMAND("time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message") CHAT_COMMAND("broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status") -CHAT_COMMAND("servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status") +CHAT_COMMAND("gametimertime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status") #if defined(CONF_SQL) CHAT_COMMAND("times", "?s?i", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTimes, this, "/times ?s?i shows last 5 times of the server or of a player beginning with name s starting with time i (i = 1 by default)") diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 1f56c8423..fc90c7498 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -1004,7 +1004,7 @@ void CCharacter::HandleBroadcast() GameServer()->SendBroadcast(aBroadcast, m_pPlayer->GetCID()); m_LastBroadcast = Server()->Tick(); } - else if (m_pPlayer->m_BroadcastTime && m_LastBroadcast + Server()->TickSpeed() * g_Config.m_SvTimeInBroadcastInterval <= Server()->Tick()) + else if (m_pPlayer->m_BroadcastTime && m_DDRaceState == DDRACE_STARTED && m_LastBroadcast + Server()->TickSpeed() * g_Config.m_SvTimeInBroadcastInterval <= Server()->Tick()) { char aBuftime[64]; int IntTime = (int)((float)(Server()->Tick() - m_StartTime) / ((float)Server()->TickSpeed())); diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 5ce8760af..189b30c04 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -40,8 +40,7 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team) m_PauseInfo.m_Respawn = false; m_EyeEmote = true; m_BroadcastTime = g_Config.m_SvTimeInBroadcast; - m_BroadcastTime = g_Config.m_SvTimeInGameTimer; - m_GameTimerTime = true; + m_GameTimerTime = g_Config.m_SvTimeInGameTimer; m_DefEmote = EMOTE_HAPPY; m_DefEmoteReset = -1;