Make Key_GetBinding take an imt instead of a name.

This commit is contained in:
Bill Currie 2016-01-04 16:06:48 +09:00
parent c25fd410a5
commit 7c16acf4aa
2 changed files with 5 additions and 6 deletions

View file

@ -533,7 +533,7 @@ void Key_Init (struct cbuf_s *cb);
void Key_Init_Cvars (void);
void Key_WriteBindings (QFile *f);
void Key_ClearStates (void);
const char *Key_GetBinding (const char *imt_name, knum_t key);
const char *Key_GetBinding (imt_t *imt, knum_t key);
void Key_SetBinding (imt_t *imt, knum_t keynum, const char *binding);
void Key_SetKeyDest(keydest_t kd);
typedef void keydest_callback_t (keydest_t);

View file

@ -944,6 +944,7 @@ static void
Key_GIB_Bind_Get_f (void)
{
const char *key, *cmd;
imt_t *imt;
int k;
if (GIB_Argc () != 2) {
@ -958,7 +959,8 @@ Key_GIB_Bind_Get_f (void)
return;
}
if (!(cmd = Key_GetBinding ("IMT_MOD", k)))
imt = Key_FindIMT ("imt_mod");
if (!imt || !(cmd = Key_GetBinding (imt, k)))
GIB_Return ("");
else
GIB_Return (cmd);
@ -1319,11 +1321,8 @@ Key_Init_Cvars (void)
}
const char *
Key_GetBinding (const char *imt_name, knum_t key)
Key_GetBinding (imt_t *imt, knum_t key)
{
imt_t *imt;
imt = Key_FindIMT (imt_name);
if (imt) {
return imt->bindings[key].str;
}