From efe9e55a980f4f2eb03331261dc2efcb734183c0 Mon Sep 17 00:00:00 2001 From: Lucas GAUTHERON Date: Sun, 28 Aug 2011 16:55:49 +0000 Subject: [PATCH] "searchbinds" command git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6620 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/console.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/src/console.cpp b/source/src/console.cpp index 419953f1..b018b8a3 100644 --- a/source/src/console.cpp +++ b/source/src/console.cpp @@ -228,6 +228,7 @@ void keybind(const char *key) if(!km) { conoutf("unknown key \"%s\"", key); return; } result(km->action); } + bool bindc(int code, const char *action) { keym *km = findbindc(code); @@ -235,6 +236,23 @@ bool bindc(int code, const char *action) else return false; } +void searchbinds(char *action) +{ + if(!action || action[0] == '\0') return; + vector names; + loopv(keyms) + { + if(strstr(keyms[i].action, action)) + { + if(names.length()) names.add(' '); + names.put(keyms[i].name, strlen(keyms[i].name)); + } + } + names.add('\0'); + result(names.getbuf()); +} + +COMMAND(searchbinds, ARG_1STR); COMMANDN(bind, bindk, ARG_2STR); COMMAND(keybind, ARG_1STR); struct releaseaction