diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-09-29 11:34:49 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-09-29 11:34:49 +0000 |
| commit | eac9658b7395a45d0b48cad340fd9ccf7bec0fde (patch) | |
| tree | d5bd824038a9b095dd8ea5d9ab4cca88ce1afb0f /src/game/client/components/voting.cpp | |
| parent | 6d44adb7114a0be6ecb1b0fabc6fe69d308cad1c (diff) | |
| download | zcatch-eac9658b7395a45d0b48cad340fd9ccf7bec0fde.tar.gz zcatch-eac9658b7395a45d0b48cad340fd9ccf7bec0fde.zip | |
added voting gui and a lot of other minor changes
Diffstat (limited to 'src/game/client/components/voting.cpp')
| -rw-r--r-- | src/game/client/components/voting.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/game/client/components/voting.cpp b/src/game/client/components/voting.cpp index e835aa8f..1386071d 100644 --- a/src/game/client/components/voting.cpp +++ b/src/game/client/components/voting.cpp @@ -7,11 +7,8 @@ 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(); + VOTING *self = (VOTING*)user_data; + self->callvote(console_arg_string(result, 0), console_arg_string(result, 1)); } void VOTING::con_vote(void *result, void *user_data) @@ -23,6 +20,27 @@ void VOTING::con_vote(void *result, void *user_data) self->vote(-1); } +void VOTING::callvote(const char *type, const char *value) +{ + NETMSG_CL_CALLVOTE msg = {0}; + msg.type = type; + msg.value = value; + msg.pack(MSGFLAG_VITAL); + client_send_msg(); +} + +void VOTING::callvote_kick(int client_id) +{ + char buf[32]; + str_format(buf, sizeof(buf), "%d", client_id); + callvote("kick", buf); +} + +void VOTING::callvote_map(const char *map) +{ + callvote("map", map); +} + void VOTING::vote(int v) { NETMSG_CL_VOTE msg = {v}; |