diff --git a/datasrc/network.py b/datasrc/network.py index 928d1ae8c..867c3bd04 100644 --- a/datasrc/network.py +++ b/datasrc/network.py @@ -3,13 +3,14 @@ from datatypes import * Pickups = Enum("PICKUP", ["HEALTH", "ARMOR", "GRENADE", "SHOTGUN", "LASER", "NINJA"]) Emotes = Enum("EMOTE", ["NORMAL", "PAIN", "HAPPY", "SURPRISE", "ANGRY", "BLINK"]) Emoticons = Enum("EMOTICON", ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY", "GHOST", "SUSHI", "SPLATTEE", "DEVILTEE", "ZOMG", "ZZZ", "WTF", "EYES", "QUESTION"]) +Votes = Enum("VOTE", ["UNKNOWN", "START_OP", "START_KICK", "START_SPEC", "END_ABORT", "END_PASS", "END_FAIL"]) PlayerFlags = Flags("PLAYERFLAG", ["CHATTING", "SCOREBOARD", "READY", "DEAD", "WATCHING"]) GameFlags = Flags("GAMEFLAG", ["TEAMS", "FLAGS", "SURVIVAL"]) GameStateFlags = Flags("GAMESTATEFLAG", ["WARMUP", "SUDDENDEATH", "ROUNDOVER", "GAMEOVER", "PAUSED", "STARTCOUNTDOWN"]) CoreEventFlags = Flags("COREEVENTFLAG", ["GROUND_JUMP", "AIR_JUMP", "HOOK_ATTACH_PLAYER", "HOOK_ATTACH_GROUND", "HOOK_HIT_NOHOOK"]) -GameMsgIDs = Enum("GAMEMSG", ["TEAM_SWAP", "VOTE_ABORT", "VOTE_PASS", "VOTE_FAIL", "VOTE_DENY_SPECCALL", "VOTE_DENY_ACTIVE", "VOTE_DENY_KICK", "VOTE_DENY_KICKID", +GameMsgIDs = Enum("GAMEMSG", ["TEAM_SWAP", "VOTE_DENY_SPECCALL", "VOTE_DENY_ACTIVE", "VOTE_DENY_KICK", "VOTE_DENY_KICKID", "VOTE_DENY_KICKSELF", "VOTE_DENY_KICKADMIN", "VOTE_DENY_SPEC", "VOTE_DENY_SPECID", "VOTE_DENY_SPECSELF", "SPEC_INVALIDID", "TEAM_SHUFFLE", "TEAM_LOCK", "TEAM_UNLOCK", "TEAM_BALANCE", "TEAM_DENY_LOCK", "TEAM_DENY_BALANCE", "CTF_DROP", "CTF_RETURN", @@ -19,11 +20,8 @@ GameMsgIDs = Enum("GAMEMSG", ["TEAM_SWAP", "VOTE_ABORT", "VOTE_PASS", "VOTE_FAIL "CTF_CAPTURE", - "VOTE_DENY_INVALIDOP", "VOTE_KICKYOU", "VOTE_FORCE", - - "VOTE_FORCEOP", "VOTE_FORCESPEC", - - "VOTE_CALLOP", "VOTE_CALLKICK", "VOTE_CALLSPEC"]) + "VOTE_DENY_INVALIDOP", "VOTE_KICKYOU"]) + RawHeader = ''' @@ -58,6 +56,7 @@ Enums = [ Pickups, Emotes, Emoticons, + Votes, GameMsgIDs, ] @@ -296,6 +295,8 @@ Messages = [ ]), NetMessage("Sv_VoteSet", [ + NetIntRange("m_ClientID", -1, 'MAX_CLIENTS-1'), + NetEnum("m_Type", Votes), NetIntRange("m_Timeout", 0, 60), NetStringStrict("m_pDescription"), NetStringStrict("m_pReason"), diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp index 13dbc8a26..d8e210966 100644 --- a/src/game/client/components/voting.cpp +++ b/src/game/client/components/voting.cpp @@ -1,12 +1,16 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ +#include + #include -#include -#include #include +#include + +#include "chat.h" #include "voting.h" + void CVoting::ConCallvote(IConsole::IResult *pResult, void *pUserData) { CVoting *pSelf = (CVoting*)pUserData; @@ -190,15 +194,62 @@ void CVoting::OnMessage(int MsgType, void *pRawMsg) if(MsgType == NETMSGTYPE_SV_VOTESET) { CNetMsg_Sv_VoteSet *pMsg = (CNetMsg_Sv_VoteSet *)pRawMsg; + OnReset(); + char aBuf[128]; if(pMsg->m_Timeout) { - OnReset(); str_copy(m_aDescription, pMsg->m_pDescription, sizeof(m_aDescription)); str_copy(m_aReason, pMsg->m_pReason, sizeof(m_aReason)); m_Closetime = time_get() + time_freq() * pMsg->m_Timeout; + if(pMsg->m_ClientID != -1) + { + switch(pMsg->m_Type) + { + case VOTE_START_OP: + str_format(aBuf, sizeof(aBuf), Localize("'%s' called vote to change server option '%s' (%s)"), m_pClient->m_aClients[pMsg->m_ClientID].m_aName, + pMsg->m_pDescription, pMsg->m_pReason); + m_pClient->m_pChat->AddLine(-1, 0, aBuf); + break; + case VOTE_START_KICK: + str_format(aBuf, sizeof(aBuf), Localize("'%s' called for vote to kick '%s' (%s)"), m_pClient->m_aClients[pMsg->m_ClientID].m_aName, + pMsg->m_pDescription, pMsg->m_pReason); + m_pClient->m_pChat->AddLine(-1, 0, aBuf); + break; + case VOTE_START_SPEC: + str_format(aBuf, sizeof(aBuf), Localize("'%s' called for vote to move '%s' to spectators (%s)"), m_pClient->m_aClients[pMsg->m_ClientID].m_aName, + pMsg->m_pDescription, pMsg->m_pReason); + m_pClient->m_pChat->AddLine(-1, 0, aBuf); + } + } } else - OnReset(); + { + switch(pMsg->m_Type) + { + case VOTE_START_OP: + str_format(aBuf, sizeof(aBuf), Localize("Admin forced server option '%s' (%s)"), pMsg->m_pDescription, pMsg->m_pReason); + m_pClient->m_pChat->AddLine(-1, 0, aBuf); + break; + case VOTE_START_SPEC: + str_format(aBuf, sizeof(aBuf), Localize("Admin moved '%s' to spectator (%s)"), pMsg->m_pDescription, pMsg->m_pReason); + m_pClient->m_pChat->AddLine(-1, 0, aBuf); + break; + case VOTE_END_ABORT: + m_pClient->m_pChat->AddLine(-1, 0, Localize("Vote aborted")); + break; + case VOTE_END_PASS: + if(pMsg->m_ClientID == -1) + m_pClient->m_pChat->AddLine(-1, 0, Localize("Admin forced vote yes")); + else + m_pClient->m_pChat->AddLine(-1, 0, Localize("Vote passed")); + break; + case VOTE_END_FAIL: + if(pMsg->m_ClientID == -1) + m_pClient->m_pChat->AddLine(-1, 0, Localize("Admin forced vote no")); + else + m_pClient->m_pChat->AddLine(-1, 0, Localize("Vote failed")); + } + } } else if(MsgType == NETMSGTYPE_SV_VOTESTATUS) { diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 4f4b07370..a6d5e5680 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -117,8 +117,6 @@ enum PARA_II, PARA_III, PARA_S, - PARA_SS, - PARA_SSS, }; struct CGameMsg @@ -130,9 +128,6 @@ struct CGameMsg static CGameMsg gs_GameMsgList[NUM_GAMEMSGS] = { {/*GAMEMSG_TEAM_SWAP*/ DO_CHAT, PARA_NONE, "Teams were swapped"}, - {/*GAMEMSG_VOTE_ABORT*/ DO_CHAT, PARA_NONE, "Vote aborted"}, - {/*GAMEMSG_VOTE_PASS*/ DO_CHAT, PARA_NONE, "Vote passed"}, - {/*GAMEMSG_VOTE_FAIL*/ DO_CHAT, PARA_NONE, "Vote failed"}, {/*GAMEMSG_VOTE_DENY_SPECCALL*/ DO_CHAT, PARA_NONE, "Spectators aren't allowed to start a vote."}, {/*GAMEMSG_VOTE_DENY_ACTIVE*/ DO_CHAT, PARA_NONE, "Wait for current vote to end before calling a new one."}, {/*GAMEMSG_VOTE_DENY_KICK*/ DO_CHAT, PARA_NONE, "Server does not allow voting to kick players"}, @@ -164,15 +159,7 @@ static CGameMsg gs_GameMsgList[NUM_GAMEMSGS] = { {/*GAMEMSG_CTF_CAPTURE*/ DO_SPECIAL, PARA_III, ""}, // special - play ctf capture sound + capture chat message {/*GAMEMSG_VOTE_DENY_INVALIDOP*/ DO_CHAT, PARA_S, "'%s' isn't an option on this server"}, - {/*GAMEMSG_VOTE_KICKYOU*/ DO_CHAT, PARA_S, "'%s' called for vote to kick you"}, - {/*GAMEMSG_VOTE_FORCE*/ DO_CHAT, PARA_S, "admin forced vote %s"}, - - {/*GAMEMSG_VOTE_FORCEOP*/ DO_CHAT, PARA_SS, "admin forced server option '%s' (%s)"}, - {/*GAMEMSG_S2_VOTE_FORCESPEC*/ DO_CHAT, PARA_SS, "admin moved '%s' to spectator (%s)"}, - - {/*GAMEMSG_VOTE_CALLOP*/ DO_CHAT, PARA_SSS, "'%s' called vote to change server option '%s' (%s)"}, - {/*GAMEMSG_VOTE_CALLKICK*/ DO_CHAT, PARA_SSS, "'%s' called for vote to kick '%s' (%s)"}, - {/*GAMEMSG_VOTE_CALLSPEC*/ DO_CHAT, PARA_SSS, "'%s' called for vote to move '%s' to spectators (%s)"} + {/*GAMEMSG_VOTE_KICKYOU*/ DO_CHAT, PARA_S, "'%s' called for vote to kick you"} }; void CGameClient::OnConsoleInit() @@ -562,8 +549,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) int aParaI[3]; int NumParaI = 0; - const char *apParaS[3]; - int NumParaS = 0; + const char *pParaS = 0; // get paras switch(gs_GameMsgList[GameMsgID].m_ParaType) @@ -575,12 +561,8 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) case PARA_I: aParaI[NumParaI++] = pUnpacker->GetInt(); break; - case PARA_SSS: - apParaS[NumParaS++] = pUnpacker->GetString(); - case PARA_SS: - apParaS[NumParaS++] = pUnpacker->GetString(); case PARA_S: - apParaS[NumParaS++] = pUnpacker->GetString(); + pParaS = pUnpacker->GetString(); break; } @@ -620,9 +602,9 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) case GAMEMSG_CTF_CAPTURE: m_pSounds->Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_CAPTURE); if(aParaI[2] <= 60*Client()->GameTickSpeed()) - str_format(aBuf, sizeof(aBuf), "The %s flag was captured by '%s' (%.2f seconds)", aParaI[0] ? "blue" : "red", m_aClients[clamp(aParaI[1], 0, MAX_CLIENTS-1)].m_aName, aParaI[2]/(float)Client()->GameTickSpeed()); + str_format(aBuf, sizeof(aBuf), "The %s flag was captured by '%s' (%.2f seconds)", aParaI[0] ? Localize("blue") : Localize("red"), m_aClients[clamp(aParaI[1], 0, MAX_CLIENTS-1)].m_aName, aParaI[2]/(float)Client()->GameTickSpeed()); else - str_format(aBuf, sizeof(aBuf), "The %s flag was captured by '%s'", aParaI[0] ? "blue" : "red", m_aClients[clamp(aParaI[1], 0, MAX_CLIENTS-1)].m_aName); + str_format(aBuf, sizeof(aBuf), "The %s flag was captured by '%s'", aParaI[0] ? Localize("blue") : Localize("red"), m_aClients[clamp(aParaI[1], 0, MAX_CLIENTS-1)].m_aName); m_pChat->AddLine(-1, 0, aBuf); } return; @@ -630,7 +612,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) // build message const char *pText = ""; - if(NumParaI == 0 && NumParaS == 0) + if(NumParaI == 0 && pParaS == 0) pText = Localize(gs_GameMsgList[GameMsgID].m_pText); else { @@ -640,12 +622,8 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) str_format(aBuf, sizeof(aBuf), Localize(gs_GameMsgList[GameMsgID].m_pText), aParaI[0], aParaI[1]); else if(NumParaI == 3) str_format(aBuf, sizeof(aBuf), Localize(gs_GameMsgList[GameMsgID].m_pText), aParaI[0], aParaI[1], aParaI[2]); - else if(NumParaS == 1) - str_format(aBuf, sizeof(aBuf), Localize(gs_GameMsgList[GameMsgID].m_pText), apParaS[0]); - else if(NumParaS == 2) - str_format(aBuf, sizeof(aBuf), Localize(gs_GameMsgList[GameMsgID].m_pText), apParaS[0], apParaS[1]); - else if(NumParaS == 3) - str_format(aBuf, sizeof(aBuf), Localize(gs_GameMsgList[GameMsgID].m_pText), apParaS[0], apParaS[1], apParaS[2]); + else if(pParaS != 0) + str_format(aBuf, sizeof(aBuf), Localize(gs_GameMsgList[GameMsgID].m_pText), pParaS); pText = aBuf; } diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 0cfe04f91..e67a25708 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -297,27 +297,8 @@ void CGameContext::SendGameMsg(int GameMsgID, const char *pParaS1, int ClientID) Server()->SendMsg(&Msg, MSGFLAG_VITAL, ClientID); } -void CGameContext::SendGameMsg(int GameMsgID, const char *pParaS1, const char *pParaS2, int ClientID) -{ - CMsgPacker Msg(NETMSGTYPE_SV_GAMEMSG); - Msg.AddInt(GameMsgID); - Msg.AddString(pParaS1, -1); - Msg.AddString(pParaS2, -1); - Server()->SendMsg(&Msg, MSGFLAG_VITAL, ClientID); -} - -void CGameContext::SendGameMsg(int GameMsgID, const char *pParaS1, const char *pParaS2, const char *pParaS3, int ClientID) -{ - CMsgPacker Msg(NETMSGTYPE_SV_GAMEMSG); - Msg.AddInt(GameMsgID); - Msg.AddString(pParaS1, -1); - Msg.AddString(pParaS2, -1); - Msg.AddString(pParaS3, -1); - Server()->SendMsg(&Msg, MSGFLAG_VITAL, ClientID); -} - // -void CGameContext::StartVote(const char *pDesc, const char *pCommand, const char *pReason) +void CGameContext::StartVote(int Type, const char *pDesc, const char *pCommand, const char *pReason) { // check if a vote is already running if(m_VoteCloseTime) @@ -335,37 +316,51 @@ void CGameContext::StartVote(const char *pDesc, const char *pCommand, const char } // start vote - m_VoteCloseTime = time_get() + time_freq()*25; + m_VoteCloseTime = time_get() + time_freq()*VOTE_TIME; str_copy(m_aVoteDescription, pDesc, sizeof(m_aVoteDescription)); str_copy(m_aVoteCommand, pCommand, sizeof(m_aVoteCommand)); str_copy(m_aVoteReason, pReason, sizeof(m_aVoteReason)); - SendVoteSet(-1); + SendVoteSet(Type, -1); m_VoteUpdate = true; } -void CGameContext::EndVote() +void CGameContext::EndVote(int Type, bool Force) { m_VoteCloseTime = 0; - SendVoteSet(-1); + if(Force) + m_VoteCreator = -1; + SendVoteSet(Type, -1); } -void CGameContext::SendVoteSet(int ClientID) +void CGameContext::SendVoteSet(int Type, int ToClientID) { CNetMsg_Sv_VoteSet Msg; if(m_VoteCloseTime) { + Msg.m_ClientID = m_VoteCreator; + Msg.m_Type = Type; Msg.m_Timeout = (m_VoteCloseTime-time_get())/time_freq(); Msg.m_pDescription = m_aVoteDescription; Msg.m_pReason = m_aVoteReason; } else { + Msg.m_ClientID = m_VoteCreator; + Msg.m_Type = Type; Msg.m_Timeout = 0; - Msg.m_pDescription = ""; - Msg.m_pReason = ""; + if(m_VoteCreator == -1) + { + Msg.m_pDescription = m_aVoteDescription; + Msg.m_pReason = m_aVoteReason; + } + else + { + Msg.m_pDescription = ""; + Msg.m_pReason = ""; + } } - Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID); + Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ToClientID); } void CGameContext::SendVoteStatus(int ClientID, int Total, int Yes, int No) @@ -466,10 +461,7 @@ void CGameContext::OnTick() { // abort the kick-vote on player-leave if(m_VoteCloseTime == -1) - { - SendGameMsg(GAMEMSG_VOTE_ABORT, -1); - EndVote(); - } + EndVote(VOTE_END_ABORT, false); else { int Total = 0, Yes = 0, No = 0; @@ -509,29 +501,20 @@ void CGameContext::OnTick() else if(ActVote < 0) No++; } - - if(Yes >= Total/2+1) - m_VoteEnforce = VOTE_ENFORCE_YES; - else if(No >= (Total+1)/2) - m_VoteEnforce = VOTE_ENFORCE_NO; } - if(m_VoteEnforce == VOTE_ENFORCE_YES) + if(m_VoteEnforce == VOTE_ENFORCE_YES || Yes >= Total/2+1) { Server()->SetRconCID(IServer::RCON_CID_VOTE); Console()->ExecuteLine(m_aVoteCommand); Server()->SetRconCID(IServer::RCON_CID_SERV); - EndVote(); - SendGameMsg(GAMEMSG_VOTE_PASS, -1); + EndVote(VOTE_END_PASS, m_VoteEnforce==VOTE_ENFORCE_YES); if(m_apPlayers[m_VoteCreator]) m_apPlayers[m_VoteCreator]->m_LastVoteCall = 0; } - else if(m_VoteEnforce == VOTE_ENFORCE_NO || time_get() > m_VoteCloseTime) - { - EndVote(); - SendGameMsg(GAMEMSG_VOTE_FAIL, -1); - } + else if(m_VoteEnforce == VOTE_ENFORCE_NO || No >= (Total+1)/2 || time_get() > m_VoteCloseTime) + EndVote(VOTE_END_FAIL, m_VoteEnforce==VOTE_ENFORCE_NO); else if(m_VoteUpdate) { m_VoteUpdate = false; @@ -658,7 +641,7 @@ void CGameContext::OnClientConnected(int ClientID, bool Dummy) // send active vote if(m_VoteCloseTime) - SendVoteSet(ClientID); + SendVoteSet(VOTE_UNKNOWN, ClientID); // send motd CNetMsg_Sv_Motd Msg; @@ -763,8 +746,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) return; } - int GMsgID = -1; - const char *pGMsgS2; + int Type = VOTE_UNKNOWN; char aDesc[VOTE_DESC_LENGTH] = {0}; char aCmd[VOTE_CMD_LENGTH] = {0}; CNetMsg_Cl_CallVote *pMsg = (CNetMsg_Cl_CallVote *)pRawMsg; @@ -777,8 +759,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) { if(str_comp_nocase(pMsg->m_Value, pOption->m_aDescription) == 0) { - GMsgID = GAMEMSG_VOTE_CALLOP; - pGMsgS2 = pOption->m_aDescription; + Type = VOTE_START_OP; str_format(aDesc, sizeof(aDesc), "%s", pOption->m_aDescription); str_format(aCmd, sizeof(aCmd), "%s", pOption->m_aCommand); break; @@ -833,8 +814,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) return; } - GMsgID = GAMEMSG_VOTE_CALLKICK; - pGMsgS2 = Server()->ClientName(KickID); + Type = VOTE_START_KICK; str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickID)); if (!g_Config.m_SvVoteKickBantime) str_format(aCmd, sizeof(aCmd), "kick %d Kicked by vote", KickID); @@ -866,20 +846,18 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) return; } - GMsgID = GAMEMSG_VOTE_CALLSPEC; - pGMsgS2 = Server()->ClientName(SpectateID); + Type = VOTE_START_SPEC; str_format(aDesc, sizeof(aDesc), "move '%s' to spectators", Server()->ClientName(SpectateID)); str_format(aCmd, sizeof(aCmd), "set_team %d -1 %d", SpectateID, g_Config.m_SvVoteSpectateRejoindelay); m_VoteClientID = SpectateID; } - if(GMsgID != -1) + if(Type != VOTE_UNKNOWN) { - SendGameMsg(GMsgID, Server()->ClientName(ClientID), pGMsgS2, pReason, -1); - StartVote(aDesc, aCmd, pReason); + m_VoteCreator = ClientID; + StartVote(Type, aDesc, aCmd, pReason); pPlayer->m_Vote = 1; pPlayer->m_VotePos = m_VotePos = 1; - m_VoteCreator = ClientID; pPlayer->m_LastVoteCall = Now; } } @@ -1381,7 +1359,9 @@ void CGameContext::ConForceVote(IConsole::IResult *pResult, void *pUserData) { if(str_comp_nocase(pValue, pOption->m_aDescription) == 0) { - pSelf->SendGameMsg(GAMEMSG_VOTE_FORCEOP, pValue, pReason, -1); + str_copy(pSelf->m_aVoteDescription, pValue, sizeof(pSelf->m_aVoteDescription)); + str_copy(pSelf->m_aVoteReason, pReason, sizeof(pSelf->m_aVoteReason)); + pSelf->EndVote(VOTE_START_OP, true); pSelf->Console()->ExecuteLine(pOption->m_aCommand); break; } @@ -1427,7 +1407,9 @@ void CGameContext::ConForceVote(IConsole::IResult *pResult, void *pUserData) return; } - pSelf->SendGameMsg(GAMEMSG_VOTE_FORCESPEC, pSelf->Server()->ClientName(SpectateID), pReason, -1); + str_copy(pSelf->m_aVoteDescription, pSelf->Server()->ClientName(SpectateID), sizeof(pSelf->m_aVoteDescription)); + str_copy(pSelf->m_aVoteReason, pReason, sizeof(pSelf->m_aVoteReason)); + pSelf->EndVote(VOTE_START_SPEC, true); str_format(aBuf, sizeof(aBuf), "set_team %d -1 %d", SpectateID, g_Config.m_SvVoteSpectateRejoindelay); pSelf->Console()->ExecuteLine(aBuf); } @@ -1458,7 +1440,6 @@ void CGameContext::ConVote(IConsole::IResult *pResult, void *pUserData) pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_YES; else if(str_comp_nocase(pResult->GetString(0), "no") == 0) pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_NO; - pSelf->SendGameMsg(GAMEMSG_VOTE_FORCE, pResult->GetString(0), -1); char aBuf[256]; str_format(aBuf, sizeof(aBuf), "forcing vote %s", pResult->GetString(0)); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf); diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index bc7a77198..eae418793 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -90,9 +90,9 @@ public: int m_LockTeams; // voting - void StartVote(const char *pDesc, const char *pCommand, const char *pReason); - void EndVote(); - void SendVoteSet(int ClientID); + void StartVote(int Type, const char *pDesc, const char *pCommand, const char *pReason); + void EndVote(int Type, bool Force); + void SendVoteSet(int Type, int ToClientID); void SendVoteStatus(int ClientID, int Total, int Yes, int No); void AbortVoteOnDisconnect(int ClientID); void AbortVoteOnTeamChange(int ClientID); @@ -112,6 +112,8 @@ public: VOTE_ENFORCE_UNKNOWN=0, VOTE_ENFORCE_NO, VOTE_ENFORCE_YES, + + VOTE_TIME=25, }; class CHeap *m_pVoteOptionHeap; CVoteOptionServer *m_pVoteOptionFirst; @@ -145,8 +147,6 @@ public: void SendGameMsg(int GameMsgID, int ParaI1, int ParaI2, int ClientID); void SendGameMsg(int GameMsgID, int ParaI1, int ParaI2, int ParaI3, int ClientID); void SendGameMsg(int GameMsgID, const char *pParaS1, int ClientID); - void SendGameMsg(int GameMsgID, const char *pParaS1, const char *pParaS2, int ClientID); - void SendGameMsg(int GameMsgID, const char *pParaS1, const char *pParaS2, const char *pParaS3, int ClientID); // void CheckPureTuning();