From 3ad8284716f96c4a09ef9fe2ba5657b5f2abf1f4 Mon Sep 17 00:00:00 2001 From: GreYFoX Date: Wed, 31 Aug 2011 12:30:18 +0200 Subject: [PATCH] Fixed #77. top5 --- src/engine/shared/console.cpp | 4 ++-- src/game/server/ddracechat.cpp | 9 +++------ src/game/server/score/file_score.cpp | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp index e7c06d453..ef8b81a23 100644 --- a/src/engine/shared/console.cpp +++ b/src/engine/shared/console.cpp @@ -377,8 +377,8 @@ CConsole::CCommand *CConsole::FindCommand(const char *pName, int FlagMask) void CConsole::ExecuteLine(const char *pStr, int ClientID) { - CConsole::ExecuteLineStroked(1, pStr); // press it - CConsole::ExecuteLineStroked(0, pStr); // then release it + CConsole::ExecuteLineStroked(1, pStr, ClientID); // press it + CConsole::ExecuteLineStroked(0, pStr, ClientID); // then release it } diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 353c22819..d8711d11a 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -249,10 +249,6 @@ void CGameContext::ConTop5(IConsole::IResult *pResult, void *pUserData) CGameContext *pSelf = (CGameContext *)pUserData; if(!CheckClientID(pResult->m_ClientID)) return; - CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; - if(!pPlayer) - return; - if(g_Config.m_SvHideScore) { pSelf->SendChatTarget(pResult->m_ClientID,"Showing the top 5 is not allowed on this server."); @@ -260,10 +256,11 @@ void CGameContext::ConTop5(IConsole::IResult *pResult, void *pUserData) } if(pResult->NumArguments() > 0) - pSelf->Score()->ShowTop5(pResult, pPlayer->GetCID(), pUserData, pResult->GetInteger(0)); + pSelf->Score()->ShowTop5(pResult, pResult->m_ClientID, pUserData, pResult->GetInteger(0)); else - pSelf->Score()->ShowTop5(pResult, pPlayer->GetCID(), pUserData); + pSelf->Score()->ShowTop5(pResult, pResult->m_ClientID, pUserData); } + #if defined(CONF_SQL) void CGameContext::ConTimes(IConsole::IResult *pResult, void *pUserData) { diff --git a/src/game/server/score/file_score.cpp b/src/game/server/score/file_score.cpp index 864a41fad..42c1598f6 100644 --- a/src/game/server/score/file_score.cpp +++ b/src/game/server/score/file_score.cpp @@ -205,7 +205,7 @@ void CFileScore::ShowTop5(IConsole::IResult *pResult, int ClientID, void *pUserD { CGameContext *pSelf = (CGameContext *)pUserData; char aBuf[512]; - pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "top5", "----------- Top 5 -----------"); + pSelf->SendChatTarget(ClientID, "----------- Top 5 -----------"); for(int i = 0; i < 5; i++) { if(i+Debut > m_Top.size()) @@ -213,9 +213,9 @@ void CFileScore::ShowTop5(IConsole::IResult *pResult, int ClientID, void *pUserD CPlayerScore *r = &m_Top[i+Debut-1]; str_format(aBuf, sizeof(aBuf), "%d. %s Time: %d minute(s) %5.2f second(s)", i+Debut, r->m_aName, (int) r->m_Score/60, r->m_Score-((int)r->m_Score/60*60)); - pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "top5", aBuf); + pSelf->SendChatTarget(ClientID, aBuf); } - pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "top5", "------------------------------"); + pSelf->SendChatTarget(ClientID, "------------------------------"); } void CFileScore::ShowRank(int ClientID, const char* pName, bool Search)