From c55cae649247bc50caa9741b5c541afbf6d1a1a0 Mon Sep 17 00:00:00 2001 From: Learath2 Date: Sun, 23 Dec 2012 19:53:57 +0200 Subject: [PATCH] Reduced length of new year event to 2 days. --- src/game/server/gamecontext.cpp | 10 ++-------- src/game/server/player.cpp | 31 +++++++++++++++---------------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 7b53fc004..195ee2981 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -693,16 +693,10 @@ void CGameContext::OnClientEnter(int ClientID) dd = atoi(d); mm = atoi(m); yy = atoi(y); - if((mm == 12 && dd >= 20)) + if((mm == 12 || mm == 1) && (dd == 31 || dd == 1)) { char aBuf[128]; - str_format(aBuf, sizeof(aBuf), "Happy %d from GreYFoX", yy+1); - SendBroadcast(aBuf, ClientID); - } - else if(mm == 1 && dd <= 20) - { - char aBuf[128]; - str_format(aBuf, sizeof(aBuf), "Happy %d from GreYFoX", yy); + str_format(aBuf, sizeof(aBuf), "Happy %d from GreYFoX", mm==12?yy+1:yy); SendBroadcast(aBuf, ClientID); } } diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 9ffcf011b..3e257b8e7 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -40,25 +40,24 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team) m_ChatScore = 0; m_EyeEmote = true; m_TimerType = g_Config.m_SvDefaultTimerType; + m_DefEmote = EMOTE_NORMAL; //New Year - time_t rawtime; - struct tm* timeinfo; - char d[16], m[16], y[16]; - int dd, mm, yy; - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - strftime (d,sizeof(y),"%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 = EMOTE_NORMAL; if (g_Config.m_SvEvents) - { - m_DefEmote = ((mm == 12 && dd >= 20) || (mm == 1 && dd <= 20)) ? EMOTE_HAPPY : EMOTE_NORMAL; + { + time_t rawtime; + struct tm* timeinfo; + char d[16], m[16], y[16]; + int dd, mm, yy; + time ( &rawtime ); + timeinfo = localtime ( &rawtime ); + strftime (d,sizeof(y),"%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;