From 55fcb67b458ec0eac5ce524899232c6322831b90 Mon Sep 17 00:00:00 2001 From: Neal Patel Date: Wed, 24 Apr 2013 16:18:00 -0400 Subject: [PATCH] Fixed an incorrect sizeof parameter. Also got rid of some warnings by removing unused variables and making a minor change to TimerType(). --- src/game/server/ddracechat.cpp | 7 ++++--- src/game/server/player.cpp | 10 ++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 3971ec689c..7551b0ca1d 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -11,7 +11,7 @@ #endif bool CheckClientID(int ClientID); -char* TimerType(int TimerType); +const char* TimerType(int TimerType); void CGameContext::ConCredits(IConsole::IResult *pResult, void *pUserData) { @@ -740,11 +740,12 @@ bool CheckClientID(int ClientID) return true; } -char* TimerType(int TimerType) +const char* TimerType(int TimerType) { - char msg[3][128] = {"game/round timer.", "broadcast.", "both game/round timer and broadcast."}; + const char* msg[3] = {"game/round timer.", "broadcast.", "both game/round timer and broadcast."}; return msg[TimerType]; } + void CGameContext::ConSayTime(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *) pUserData; diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 3e257b8e79..de0d0d2226 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -44,19 +44,17 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team) //New Year if (g_Config.m_SvEvents) - { + { time_t rawtime; struct tm* timeinfo; - char d[16], m[16], y[16]; - int dd, mm, yy; + char d[16], m[16]; + int dd, mm; time ( &rawtime ); timeinfo = localtime ( &rawtime ); - strftime (d,sizeof(y),"%d",timeinfo); + strftime (d,sizeof(d),"%d",timeinfo); strftime (m,sizeof(m),"%m",timeinfo); - strftime (y,sizeof(y),"%Y",timeinfo); dd = atoi(d); mm = atoi(m); - yy = atoi(y); m_DefEmote = ((mm == 12 && dd == 31) || (mm == 1 && dd == 1)) ? EMOTE_HAPPY : EMOTE_NORMAL; } m_DefEmoteReset = -1;