From b65a26fe93e54af74d6304e66ec5942ecf4c48e8 Mon Sep 17 00:00:00 2001 From: oy Date: Mon, 11 Oct 2010 01:06:44 +0200 Subject: [PATCH] fixed last commits --- data/languages/french.txt | 8 ++++---- src/engine/server/server.cpp | 2 +- src/game/client/components/menus_ingame.cpp | 11 ++++++----- src/game/client/components/voting.cpp | 13 ++++++++----- src/game/client/components/voting.h | 4 ++-- src/game/server/gamecontext.cpp | 13 ++++++++----- 6 files changed, 29 insertions(+), 22 deletions(-) diff --git a/data/languages/french.txt b/data/languages/french.txt index d028cc179..eaaa09dab 100644 --- a/data/languages/french.txt +++ b/data/languages/french.txt @@ -209,7 +209,7 @@ File == Fichier Filename: -== Nom du fichier : +== Nom du fichier: Filter == Filtre @@ -236,7 +236,7 @@ Game type == Type de jeu Game types: -== Types de jeu : +== Types de jeu: General == Général @@ -335,7 +335,7 @@ Map == Carte Maximum ping: -== Ping maximum : +== Ping maximum: Miscellaneous == Divers @@ -371,7 +371,7 @@ Nickname == Pseudonyme Name: -== Nom : +== Nom: No == Non diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index fc8ad4119..3b8771e41 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -634,7 +634,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) { // OH FUCK! wrong version, drop him char aReason[256]; - str_format(aReason, sizeof(aReason), "Wrong version : server is running \"%s\" and client \"%s\"", GameServer()->NetVersion(), aVersion); + str_format(aReason, sizeof(aReason), "Wrong version. Server is running '%s' and client '%s'", GameServer()->NetVersion(), aVersion); m_NetServer.Drop(ClientId, aReason); return; } diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 972b1f594..236a25dc8 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -425,13 +425,13 @@ void CMenus::RenderServerControl(CUIRect MainView) if(s_ControlPage == 1) { CUIRect Reason; - Bottom.VSplitRight(140.0f, &Bottom, &Reason); - Bottom.VSplitRight(200.0f, &Bottom, &Reason); + Bottom.VSplitRight(40.0f, &Bottom, 0); + Bottom.VSplitRight(160.0f, &Bottom, &Reason); + Reason.HSplitTop(5.0f, 0, &Reason); const char *pLabel = Localize("Reason:"); UI()->DoLabel(&Reason, pLabel, 14.0f, -1); float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1); - Reason.VSplitLeft(w, 0, &Reason); - Reason.VSplitLeft(10.0f, 0, &Reason); + Reason.VSplitLeft(w+10.0f, 0, &Reason); static float s_Offset = 0.0f; DoEditBox(&m_aCallvoteReason, &Reason, m_aCallvoteReason, sizeof(m_aCallvoteReason), 14.0f, &s_Offset, false, CUI::CORNER_ALL); } @@ -453,7 +453,8 @@ void CMenus::RenderServerControl(CUIRect MainView) if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS && m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer]) { - m_pClient->m_pVoting->ForcevoteKick(m_CallvoteSelectedPlayer); + m_pClient->m_pVoting->ForcevoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason); + m_aCallvoteReason[0] = 0; SetActive(false); } } diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp index c5e6a56c9..8a98e1b08 100644 --- a/src/game/client/components/voting.cpp +++ b/src/game/client/components/voting.cpp @@ -29,7 +29,7 @@ void CVoting::Callvote(const char *pType, const char *pValue) Client()->SendPackMsg(&Msg, MSGFLAG_VITAL); } -void CVoting::CallvoteKick(int ClientId, char *pReason) +void CVoting::CallvoteKick(int ClientId, const char *pReason) { char aBuf[32]; if(pReason[0]) @@ -55,11 +55,14 @@ void CVoting::CallvoteOption(int OptionId) } } -void CVoting::ForcevoteKick(int ClientId) +void CVoting::ForcevoteKick(int ClientId, const char *pReason) { - char Buf[32]; - str_format(Buf, sizeof(Buf), "kick %d", ClientId); - Client()->Rcon(Buf); + char aBuf[32]; + if(pReason[0]) + str_format(aBuf, sizeof(aBuf), "kick %d \"%s\"", ClientId, pReason); + else + str_format(aBuf, sizeof(aBuf), "kick %d", ClientId); + Client()->Rcon(aBuf); } void CVoting::ForcevoteOption(int OptionId) diff --git a/src/game/client/components/voting.h b/src/game/client/components/voting.h index 1fc2aa530..ff982640e 100644 --- a/src/game/client/components/voting.h +++ b/src/game/client/components/voting.h @@ -39,9 +39,9 @@ public: void RenderBars(CUIRect Bars, bool Text); - void CallvoteKick(int ClientId, char *pReason); + void CallvoteKick(int ClientId, const char *pReason); void CallvoteOption(int Option); - void ForcevoteKick(int ClientId); + void ForcevoteKick(int ClientId, const char *pReason); void ForcevoteOption(int Option); void Vote(int v); // -1 = no, 1 = yes diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 95a7e5582..0faba6fc1 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -670,21 +670,24 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) } const char *pReason = "No reason given"; - for(int i = 0; i < str_length(pMsg->m_Value)-1; i++) + for(const char *p = pMsg->m_Value; *p; ++p) { - if(pMsg->m_Value[i] == ' ') - pReason = &pMsg->m_Value[i+1]; + if(*p == ' ') + { + pReason = p+1; + break; + } } str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to kick '%s' (%s)", Server()->ClientName(ClientId), Server()->ClientName(KickId), pReason); str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickId)); if (!g_Config.m_SvVoteKickBantime) - str_format(aCmd, sizeof(aCmd), "kick %d %s", KickId, pReason); + str_format(aCmd, sizeof(aCmd), "kick %d \"Kicked by vote\"", KickId); else { char aBuf[64] = {0}; Server()->GetClientIP(KickId, aBuf, sizeof(aBuf)); - str_format(aCmd, sizeof(aCmd), "ban %s %d %s", aBuf, g_Config.m_SvVoteKickBantime, pReason); + str_format(aCmd, sizeof(aCmd), "ban %s %d \"Banned by vote\"", aBuf, g_Config.m_SvVoteKickBantime); } }