Change key binds from array to linked list

Key bindings were stored as a fixed-size array, indexed by the input
character, pointing to the extended commands.  This changes that into
a linked list of an intermediary struct Cmd_bind, storing the input key
and the pointer to the command.

This is just code cleanup for future enhancements, and should have
no effect on gameplay.
This commit is contained in:
Pasi Kallinen
2026-03-20 17:28:27 +02:00
parent 044a229467
commit c595f241e6
8 changed files with 228 additions and 81 deletions

View File

@@ -252,7 +252,7 @@ struct cmd {
boolean swap_yz; /* QWERTZ keyboards; use z to move NW, y to zap */
const char *dirchars; /* current movement/direction characters */
const char *alphadirchars; /* same as dirchars if !numpad */
const struct ext_func_tab *commands[256]; /* indexed by input character */
struct Cmd_bind *cmdbinds;
const struct ext_func_tab *mousebtn[NUM_MOUSE_BUTTONS];
char spkeys[NUM_NHKF];
char extcmd_char; /* key that starts an extended command ('#') */