Add toggle extended command

Allows the user to configure a key binding to toggle any boolean
option, for example:

BIND=':toggle(price_quotes)
BIND=v:toggle(autodig)

The option must be settable in-game.
This commit is contained in:
Pasi Kallinen
2026-03-21 11:52:36 +02:00
parent 62a50413d3
commit 63a78edcfa
7 changed files with 167 additions and 12 deletions

View File

@@ -22,6 +22,7 @@
#define MOUSECMD 0x0800 /* cmd allowed to be bound to mouse button */
#define CMD_INSANE 0x1000 /* suppress sanity check (for ^P and ^R) */
#define AUTOCOMP_ADJ 0x2000 /* user changed command autocompletion */
#define CMD_PARAM 0x4000 /* command requires a param from key bind */
/* flags for extcmds_match() */
#define ECM_NOFLAGS 0
@@ -33,6 +34,7 @@
struct Cmd_bind {
uchar key;
boolean userbind; /* added by user */
char *param;
const struct ext_func_tab *cmd;
struct Cmd_bind *next;
};