diff options
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}; |