From 6d44adb7114a0be6ecb1b0fabc6fe69d308cad1c Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Thu, 25 Sep 2008 14:04:02 +0000 Subject: fixed keybindings. reworked the voting a bit. added vote spamming protection. added ingame voting hud. --- src/game/client/components/binds.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/game/client/components/binds.cpp') diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp index 7fa5da5e..b55e7333 100644 --- a/src/game/client/components/binds.cpp +++ b/src/game/client/components/binds.cpp @@ -63,6 +63,21 @@ const char *BINDS::get(int keyid) return ""; } +const char *BINDS::get_key(const char *bindstr) +{ + for(int keyid = 0; keyid < KEY_LAST; keyid++) + { + const char *bind = get(keyid); + if(!bind[0]) + continue; + + if(strcmp(bind, bindstr) == 0) + return inp_key_name(keyid); + } + + return ""; +} + void BINDS::set_defaults() { // set default key bindings @@ -90,6 +105,9 @@ void BINDS::set_defaults() bind('T', "chat all"); bind('Y', "chat team"); + + bind(KEY_F3, "vote yes"); + bind(KEY_F4, "vote no"); } void BINDS::on_console_init() @@ -104,8 +122,6 @@ void BINDS::on_console_init() set_defaults(); } - - void BINDS::con_bind(void *result, void *user_data) { BINDS *binds = (BINDS *)user_data; @@ -159,7 +175,7 @@ void BINDS::con_dump_binds(void *result, void *user_data) int BINDS::get_key_id(const char *key_name) { // check for numeric - if(key_name[0] == '#') + if(key_name[0] == '&') { int i = atoi(key_name+1); if(i > 0 && i < KEY_LAST) -- cgit 1.4.1