about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-03-25 09:49:21 +0100
committeroy <Tom_Adams@web.de>2011-03-25 09:49:21 +0100
commit8ad3def65ea79f66c7508c219e05da3e5e117fe9 (patch)
tree271fe1749241106456734d4d4e63e0171524b48a /src/game/client
parentd78c84b105341ac85d735445fa04265e64017802 (diff)
downloadzcatch-8ad3def65ea79f66c7508c219e05da3e5e117fe9.tar.gz
zcatch-8ad3def65ea79f66c7508c219e05da3e5e117fe9.zip
added aliases for votes. Closes #144
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/components/menus_ingame.cpp2
-rw-r--r--src/game/client/components/voting.cpp12
-rw-r--r--src/game/client/components/voting.h6
-rw-r--r--src/game/client/gameclient.cpp2
4 files changed, 8 insertions, 14 deletions
diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp
index 8844e73d..c9d39be1 100644
--- a/src/game/client/components/menus_ingame.cpp
+++ b/src/game/client/components/menus_ingame.cpp
@@ -344,7 +344,7 @@ void CMenus::RenderServerControlServer(CUIRect MainView)
 		CListboxItem Item = UiDoListboxNextItem(pOption);
 		
 		if(Item.m_Visible)
-			UI()->DoLabelScaled(&Item.m_Rect, FormatCommand(pOption->m_aCommand), 16.0f, -1);
+			UI()->DoLabelScaled(&Item.m_Rect, FormatCommand(pOption->m_aDescription), 16.0f, -1);
 	}
 	
 	m_CallvoteSelectedOption = UiDoListboxEnd(&s_ScrollValue, 0);
diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp
index e2531818..3718a20a 100644
--- a/src/game/client/components/voting.cpp
+++ b/src/game/client/components/voting.cpp
@@ -48,7 +48,7 @@ void CVoting::CallvoteOption(int OptionId)
 	{
 		if(OptionId == 0)
 		{
-			Callvote("option", pOption->m_aCommand);
+			Callvote("option", pOption->m_aDescription);
 			break;
 		}
 		
@@ -74,7 +74,7 @@ void CVoting::ForcevoteOption(int OptionId)
 	{
 		if(OptionId == 0)
 		{
-			Client()->Rcon(pOption->m_aCommand);
+			Client()->Rcon(pOption->m_aDescription);
 			break;
 		}
 		
@@ -108,7 +108,6 @@ void CVoting::OnReset()
 {
 	m_Closetime = 0;
 	m_aDescription[0] = 0;
-	m_aCommand[0] = 0;
 	m_Yes = m_No = m_Pass = m_Total = 0;
 	m_Voted = 0;
 }
@@ -128,7 +127,6 @@ void CVoting::OnMessage(int MsgType, void *pRawMsg)
 		{
 			OnReset();
 			str_copy(m_aDescription, pMsg->m_pDescription, sizeof(m_aDescription));
-			str_copy(m_aCommand, pMsg->m_pCommand, sizeof(m_aCommand));
 			m_Closetime = time_get() + time_freq() * pMsg->m_Timeout;
 		}
 		else
@@ -149,9 +147,8 @@ void CVoting::OnMessage(int MsgType, void *pRawMsg)
 	else if(MsgType == NETMSGTYPE_SV_VOTEOPTION)
 	{
 		CNetMsg_Sv_VoteOption *pMsg = (CNetMsg_Sv_VoteOption *)pRawMsg;
-		int Len = str_length(pMsg->m_pCommand);
 	
-		CVoteOption *pOption = (CVoteOption *)m_Heap.Allocate(sizeof(CVoteOption) + Len);
+		CVoteOption *pOption = (CVoteOption *)m_Heap.Allocate(sizeof(CVoteOption));
 		pOption->m_pNext = 0;
 		pOption->m_pPrev = m_pLast;
 		if(pOption->m_pPrev)
@@ -160,8 +157,7 @@ void CVoting::OnMessage(int MsgType, void *pRawMsg)
 		if(!m_pFirst)
 			m_pFirst = pOption;
 		
-		mem_copy(pOption->m_aCommand, pMsg->m_pCommand, Len+1);
-
+		str_copy(pOption->m_aDescription, pMsg->m_pDescription, sizeof(pOption->m_aDescription));
 	}
 }
 
diff --git a/src/game/client/components/voting.h b/src/game/client/components/voting.h
index 87e0ec10..151ecbfc 100644
--- a/src/game/client/components/voting.h
+++ b/src/game/client/components/voting.h
@@ -14,8 +14,7 @@ class CVoting : public CComponent
 	static void ConVote(IConsole::IResult *pResult, void *pUserData);
 	
 	int64 m_Closetime;
-	char m_aDescription[512];
-	char m_aCommand[512];
+	char m_aDescription[64];
 	int m_Voted;
 	
 	void ClearOptions();
@@ -27,7 +26,7 @@ public:
 	{
 		CVoteOption *m_pNext;
 		CVoteOption *m_pPrev;
-		char m_aCommand[1];
+		char m_aDescription[64];
 	};
 	
 	CVoteOption *m_pFirst;
@@ -52,7 +51,6 @@ public:
 	bool IsVoting() { return m_Closetime != 0; }
 	int TakenChoice() const { return m_Voted; }
 	const char *VoteDescription() const { return m_aDescription; }
-	const char *VoteCommand() const { return m_aCommand; }
 	
 	int m_Yes, m_No, m_Pass, m_Total;
 };
diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp
index 21180b40..c6419b34 100644
--- a/src/game/client/gameclient.cpp
+++ b/src/game/client/gameclient.cpp
@@ -197,7 +197,7 @@ void CGameClient::OnConsoleInit()
 	Console()->Register("say", "r", CFGFLAG_SERVER, 0, 0, "Say in chat");
 	Console()->Register("set_team", "ii", CFGFLAG_SERVER, 0, 0, "Set team of player to team");
 	Console()->Register("set_team_all", "i", CFGFLAG_SERVER, 0, 0, "Set team of all players to team");
-	Console()->Register("addvote", "r", CFGFLAG_SERVER, 0, 0, "Add a voting option");
+	Console()->Register("add_vote", "sr", CFGFLAG_SERVER, 0, 0, "Add a voting option");
 	Console()->Register("clear_votes", "", CFGFLAG_SERVER, 0, 0, "Clears the voting options");
 	Console()->Register("vote", "r", CFGFLAG_SERVER, 0, 0, "Force a vote to yes/no");