about summary refs log tree commit diff
path: root/src/game/client/components/voting.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-09-25 12:23:44 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-09-25 12:23:44 +0000
commitaaaba4f4039f3643d1a040dfe1c9715be49371e2 (patch)
treec396f83ae65eaa4b0f7799eb3650de6b72276dd9 /src/game/client/components/voting.cpp
parent059c2ee4cb4d0860b1faf86f2f3b17511260867c (diff)
downloadzcatch-aaaba4f4039f3643d1a040dfe1c9715be49371e2.tar.gz
zcatch-aaaba4f4039f3643d1a040dfe1c9715be49371e2.zip
continued on the voting
Diffstat (limited to 'src/game/client/components/voting.cpp')
-rw-r--r--src/game/client/components/voting.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp
index b81cfb97..d90e617f 100644
--- a/src/game/client/components/voting.cpp
+++ b/src/game/client/components/voting.cpp
@@ -4,12 +4,29 @@
 
 void VOTING::con_callvote(void *result, void *user_data)
 {
+	NETMSG_CL_CALLVOTE msg = {0};
+	msg.type = console_arg_string(result, 0);
+	msg.value = console_arg_string(result, 1);
+	msg.pack(MSGFLAG_VITAL);
+	client_send_msg();
 }
 
 void VOTING::con_vote(void *result, void *user_data)
 {
+	VOTING *self = (VOTING *)user_data;
+	if(str_comp_nocase(console_arg_string(result, 0), "yes") == 0)
+		self->vote(1);
+	else if(str_comp_nocase(console_arg_string(result, 0), "no") == 0)
+		self->vote(-1);
 }
-	
+
+void VOTING::vote(int v)
+{
+	NETMSG_CL_VOTE msg = {v};
+	msg.pack(MSGFLAG_VITAL);
+	client_send_msg();
+}
+
 VOTING::VOTING()
 {
 	on_reset();
@@ -26,7 +43,7 @@ void VOTING::on_reset()
 
 void VOTING::on_console_init()
 {
-	MACRO_REGISTER_COMMAND("callvote", "r", con_callvote, this);
+	MACRO_REGISTER_COMMAND("callvote", "sr", con_callvote, this);
 	MACRO_REGISTER_COMMAND("vote", "r", con_vote, this);
 }