diff --git a/data/languages/bosnian.txt b/data/languages/bosnian.txt index e5a7819c6..a38ed45a3 100644 --- a/data/languages/bosnian.txt +++ b/data/languages/bosnian.txt @@ -519,6 +519,9 @@ Your skin -Page %d- == +Add +== + Add Friend == @@ -636,6 +639,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + no limit == diff --git a/data/languages/czech.txt b/data/languages/czech.txt index ff4c9bf87..a0602ce6e 100644 --- a/data/languages/czech.txt +++ b/data/languages/czech.txt @@ -459,6 +459,9 @@ Your skin -Page %d- == +Add +== + Add Friend == @@ -633,6 +636,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + Warmup == diff --git a/data/languages/dutch.txt b/data/languages/dutch.txt index d42685911..d2d4c2d04 100644 --- a/data/languages/dutch.txt +++ b/data/languages/dutch.txt @@ -543,6 +543,9 @@ no limit -Page %d- == +Add +== + Add Friend == @@ -639,5 +642,11 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + ##### old translations ##### diff --git a/data/languages/finnish.txt b/data/languages/finnish.txt index 265fc40ca..7233cbcab 100644 --- a/data/languages/finnish.txt +++ b/data/languages/finnish.txt @@ -483,6 +483,9 @@ Your skin -Page %d- == +Add +== + Add Friend == @@ -636,6 +639,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + no limit == diff --git a/data/languages/french.txt b/data/languages/french.txt index 46c6e8e86..5f4de5975 100644 --- a/data/languages/french.txt +++ b/data/languages/french.txt @@ -531,6 +531,9 @@ no limit -Page %d- == +Add +== + Add Friend == @@ -639,5 +642,11 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + ##### old translations ##### diff --git a/data/languages/german.txt b/data/languages/german.txt index ad0bb5718..01daf7ebb 100644 --- a/data/languages/german.txt +++ b/data/languages/german.txt @@ -543,6 +543,9 @@ no limit -Page %d- == +Add +== + Add Friend == @@ -639,5 +642,11 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + ##### old translations ##### diff --git a/data/languages/italian.txt b/data/languages/italian.txt index 05e4306bf..9a510a89e 100644 --- a/data/languages/italian.txt +++ b/data/languages/italian.txt @@ -525,6 +525,9 @@ no limit -Page %d- == +Add +== + Add Friend == @@ -636,6 +639,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + Warmup == diff --git a/data/languages/polish.txt b/data/languages/polish.txt index a75e58364..59fff9399 100644 --- a/data/languages/polish.txt +++ b/data/languages/polish.txt @@ -486,6 +486,9 @@ Your skin -Page %d- == +Add +== + Add Friend == @@ -636,6 +639,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + no limit == diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt index ec911ef05..87a717f2b 100644 --- a/data/languages/portuguese.txt +++ b/data/languages/portuguese.txt @@ -480,6 +480,9 @@ Your skin -Page %d- == +Add +== + Add Friend == @@ -636,6 +639,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + no limit == diff --git a/data/languages/romanian.txt b/data/languages/romanian.txt index 90e7e17c2..b47cd867d 100644 --- a/data/languages/romanian.txt +++ b/data/languages/romanian.txt @@ -543,6 +543,9 @@ no limit -Page %d- == +Add +== + Add Friend == @@ -639,5 +642,11 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + ##### old translations ##### diff --git a/data/languages/russian.txt b/data/languages/russian.txt index 6f33cca01..1bde3f9db 100644 --- a/data/languages/russian.txt +++ b/data/languages/russian.txt @@ -489,6 +489,9 @@ Your skin -Page %d- == +Add +== + Add Friend == @@ -636,6 +639,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + no limit == diff --git a/data/languages/serbian.txt b/data/languages/serbian.txt index a3537e5af..6096e63c6 100644 --- a/data/languages/serbian.txt +++ b/data/languages/serbian.txt @@ -483,6 +483,9 @@ Your skin -Page %d- == +Add +== + Add Friend == @@ -636,6 +639,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + no limit == diff --git a/data/languages/spanish.txt b/data/languages/spanish.txt index 8ceb991aa..12e8a6757 100644 --- a/data/languages/spanish.txt +++ b/data/languages/spanish.txt @@ -543,6 +543,9 @@ no limit -Page %d- == +Add +== + Add Friend == @@ -639,5 +642,11 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + ##### old translations ##### diff --git a/data/languages/swedish.txt b/data/languages/swedish.txt index d45eda0d0..962960990 100644 --- a/data/languages/swedish.txt +++ b/data/languages/swedish.txt @@ -453,6 +453,9 @@ You must restart the game for all settings to take effect. -Page %d- == +Add +== + Add Friend == @@ -630,6 +633,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + Warmup == diff --git a/data/languages/ukrainian.txt b/data/languages/ukrainian.txt index 93b4742ec..1dca7066e 100644 --- a/data/languages/ukrainian.txt +++ b/data/languages/ukrainian.txt @@ -507,6 +507,9 @@ Your skin -Page %d- == +Add +== + Add Friend == @@ -636,6 +639,12 @@ Unable to rename the demo Version: == +Vote command: +== + +Vote description: +== + no limit == diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 01efda0a0..27c2875b7 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -414,8 +414,9 @@ void CMenus::RenderServerControl(CUIRect MainView) } } + CUIRect Bottom, Extended; + MainView.HSplitBottom(90.0f, &MainView, &Extended); MainView.Margin(10.0f, &MainView); - CUIRect Bottom; MainView.HSplitBottom(ms_ButtonHeight + 5*2, &MainView, &Bottom); Bottom.HMargin(5.0f, &Bottom); @@ -469,11 +470,17 @@ void CMenus::RenderServerControl(CUIRect MainView) static float s_Offset = 0.0f; DoEditBox(&m_aCallvoteReason, &Reason, m_aCallvoteReason, sizeof(m_aCallvoteReason), 14.0f, &s_Offset, false, CUI::CORNER_ALL); - // force vote button (only available when authed in rcon) + // extended features (only available when authed in rcon) if(Client()->RconAuthed()) { + // background + Extended.Margin(10.0f, &Extended); + Extended.HSplitTop(20.0f, &Bottom, &Extended); + Extended.HSplitTop(5.0f, 0, &Extended); + + // force vote + Bottom.VSplitLeft(5.0f, 0, &Bottom); Bottom.VSplitLeft(120.0f, &Button, &Bottom); - static int s_ForceVoteButton = 0; if(DoButton_Menu(&s_ForceVoteButton, Localize("Force vote"), 0, &Button)) { @@ -499,6 +506,44 @@ void CMenus::RenderServerControl(CUIRect MainView) } m_aCallvoteReason[0] = 0; } + + if(s_ControlPage == 0) + { + // remove vote + Bottom.VSplitRight(10.0f, &Bottom, 0); + Bottom.VSplitRight(120.0f, 0, &Button); + static int s_RemoveVoteButton = 0; + if(DoButton_Menu(&s_RemoveVoteButton, Localize("Remove"), 0, &Button)) + m_pClient->m_pVoting->RemovevoteOption(m_CallvoteSelectedOption); + + + // add vote + Extended.HSplitTop(20.0f, &Bottom, &Extended); + Bottom.VSplitLeft(5.0f, 0, &Bottom); + Bottom.VSplitLeft(250.0f, &Button, &Bottom); + UI()->DoLabelScaled(&Button, Localize("Vote description:"), 14.0f, -1); + + Bottom.VSplitLeft(20.0f, 0, &Button); + UI()->DoLabelScaled(&Button, Localize("Vote command:"), 14.0f, -1); + + static char s_aVoteDescription[64] = {0}; + static char s_aVoteCommand[512] = {0}; + Extended.HSplitTop(20.0f, &Bottom, &Extended); + Bottom.VSplitRight(10.0f, &Bottom, 0); + Bottom.VSplitRight(120.0f, &Bottom, &Button); + static int s_AddVoteButton = 0; + if(DoButton_Menu(&s_AddVoteButton, Localize("Add"), 0, &Button)) + m_pClient->m_pVoting->AddvoteOption(s_aVoteDescription, s_aVoteCommand); + + Bottom.VSplitLeft(5.0f, 0, &Bottom); + Bottom.VSplitLeft(250.0f, &Button, &Bottom); + static float s_OffsetDesc = 0.0f; + DoEditBox(&s_aVoteDescription, &Button, s_aVoteDescription, sizeof(s_aVoteDescription), 14.0f, &s_OffsetDesc, false, CUI::CORNER_ALL); + + Bottom.VMargin(20.0f, &Button); + static float s_OffsetCmd = 0.0f; + DoEditBox(&s_aVoteCommand, &Button, s_aVoteCommand, sizeof(s_aVoteCommand), 14.0f, &s_OffsetCmd, false, CUI::CORNER_ALL); + } } } } diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp index 55343313b..0eddf805b 100644 --- a/src/game/client/components/voting.cpp +++ b/src/game/client/components/voting.cpp @@ -63,12 +63,12 @@ void CVoting::CallvoteKick(int ClientID, const char *pReason, bool ForceVote) } } -void CVoting::CallvoteOption(int OptionId, const char *pReason, bool ForceVote) +void CVoting::CallvoteOption(int OptionID, const char *pReason, bool ForceVote) { CVoteOptionClient *pOption = m_pFirst; - while(pOption && OptionId >= 0) + while(pOption && OptionID >= 0) { - if(OptionId == 0) + if(OptionID == 0) { if(ForceVote) { @@ -81,11 +81,36 @@ void CVoting::CallvoteOption(int OptionId, const char *pReason, bool ForceVote) break; } - OptionId--; + OptionID--; pOption = pOption->m_pNext; } } +void CVoting::RemovevoteOption(int OptionID) +{ + CVoteOptionClient *pOption = m_pFirst; + while(pOption && OptionID >= 0) + { + if(OptionID == 0) + { + char aBuf[128]; + str_format(aBuf, sizeof(aBuf), "remove_vote \"%s\"", pOption->m_aDescription); + Client()->Rcon(aBuf); + break; + } + + OptionID--; + pOption = pOption->m_pNext; + } +} + +void CVoting::AddvoteOption(const char *pDescription, const char *pCommand) +{ + char aBuf[128]; + str_format(aBuf, sizeof(aBuf), "add_vote \"%s\" %s", pDescription, pCommand); + Client()->Rcon(aBuf); +} + void CVoting::Vote(int v) { CNetMsg_Cl_Vote Msg = {v}; diff --git a/src/game/client/components/voting.h b/src/game/client/components/voting.h index d2a888832..cfba06050 100644 --- a/src/game/client/components/voting.h +++ b/src/game/client/components/voting.h @@ -43,7 +43,9 @@ public: void CallvoteSpectate(int ClientID, const char *pReason, bool ForceVote = false); void CallvoteKick(int ClientID, const char *pReason, bool ForceVote = false); - void CallvoteOption(int Option, const char *pReason, bool ForceVote = false); + void CallvoteOption(int OptionID, const char *pReason, bool ForceVote = false); + void RemovevoteOption(int OptionID); + void AddvoteOption(const char *pDescription, const char *pCommand); void Vote(int v); // -1 = no, 1 = yes