Mark extended commands accepting m-prefix in the command flags
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#define CMD_NOT_AVAILABLE 0x10 /* recognized but non-functional (!SHELL,&c) */
|
#define CMD_NOT_AVAILABLE 0x10 /* recognized but non-functional (!SHELL,&c) */
|
||||||
#define NOFUZZERCMD 0x20 /* fuzzer cannot execute this command */
|
#define NOFUZZERCMD 0x20 /* fuzzer cannot execute this command */
|
||||||
#define INTERNALCMD 0x40 /* only for internal use, not for user */
|
#define INTERNALCMD 0x40 /* only for internal use, not for user */
|
||||||
|
#define CMD_M_PREFIX 0x80 /* accepts menu prefix */
|
||||||
|
|
||||||
struct ext_func_tab {
|
struct ext_func_tab {
|
||||||
uchar key;
|
uchar key;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ static void mon_chain(winid, const char *, struct monst *, boolean, long *,
|
|||||||
long *);
|
long *);
|
||||||
static void contained_stats(winid, const char *, long *, long *);
|
static void contained_stats(winid, const char *, long *, long *);
|
||||||
static void misc_stats(winid, long *, long *);
|
static void misc_stats(winid, long *, long *);
|
||||||
static boolean accept_menu_prefix(int (*)(void));
|
static boolean accept_menu_prefix(const struct ext_func_tab *);
|
||||||
|
|
||||||
static void add_herecmd_menuitem(winid, int (*)(void), const char *);
|
static void add_herecmd_menuitem(winid, int (*)(void), const char *);
|
||||||
static char here_cmd_menu(boolean);
|
static char here_cmd_menu(boolean);
|
||||||
@@ -387,7 +387,7 @@ doextcmd(void)
|
|||||||
func = extcmdlist[idx].ef_funct;
|
func = extcmdlist[idx].ef_funct;
|
||||||
if (!can_do_extcmd(&extcmdlist[idx]))
|
if (!can_do_extcmd(&extcmdlist[idx]))
|
||||||
return 0;
|
return 0;
|
||||||
if (iflags.menu_requested && !accept_menu_prefix(func)) {
|
if (iflags.menu_requested && !accept_menu_prefix(&extcmdlist[idx])) {
|
||||||
pline("'%s' prefix has no effect for the %s command.",
|
pline("'%s' prefix has no effect for the %s command.",
|
||||||
visctrl(g.Cmd.spkeys[NHKF_REQMENU]),
|
visctrl(g.Cmd.spkeys[NHKF_REQMENU]),
|
||||||
extcmdlist[idx].ef_txt);
|
extcmdlist[idx].ef_txt);
|
||||||
@@ -421,7 +421,7 @@ doc_extcmd_flagstr(winid menuwin,
|
|||||||
MENU_ITEMFLAGS_NONE);
|
MENU_ITEMFLAGS_NONE);
|
||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
} else {
|
} else {
|
||||||
boolean mprefix = accept_menu_prefix(efp->ef_funct),
|
boolean mprefix = accept_menu_prefix(efp),
|
||||||
autocomplete = (efp->flags & AUTOCOMPLETE) != 0;
|
autocomplete = (efp->flags & AUTOCOMPLETE) != 0;
|
||||||
char *p = Abuf;
|
char *p = Abuf;
|
||||||
|
|
||||||
@@ -1852,15 +1852,15 @@ doterrain(void)
|
|||||||
such as ^O/#overview and C/N/#name */
|
such as ^O/#overview and C/N/#name */
|
||||||
struct ext_func_tab extcmdlist[] = {
|
struct ext_func_tab extcmdlist[] = {
|
||||||
{ '#', "#", "perform an extended command",
|
{ '#', "#", "perform an extended command",
|
||||||
doextcmd, IFBURIED | GENERALCMD, NULL },
|
doextcmd, IFBURIED | GENERALCMD | CMD_M_PREFIX, NULL },
|
||||||
{ M('?'), "?", "list all extended commands",
|
{ M('?'), "?", "list all extended commands",
|
||||||
doextlist, IFBURIED | AUTOCOMPLETE | GENERALCMD, NULL },
|
doextlist, IFBURIED | AUTOCOMPLETE | GENERALCMD | CMD_M_PREFIX, NULL },
|
||||||
{ M('a'), "adjust", "adjust inventory letters",
|
{ M('a'), "adjust", "adjust inventory letters",
|
||||||
doorganize, IFBURIED | AUTOCOMPLETE, NULL },
|
doorganize, IFBURIED | AUTOCOMPLETE, NULL },
|
||||||
{ M('A'), "annotate", "name current level",
|
{ M('A'), "annotate", "name current level",
|
||||||
donamelevel, IFBURIED | AUTOCOMPLETE, NULL },
|
donamelevel, IFBURIED | AUTOCOMPLETE, NULL },
|
||||||
{ 'a', "apply", "apply (use) a tool (pick-axe, key, lamp...)",
|
{ 'a', "apply", "apply (use) a tool (pick-axe, key, lamp...)",
|
||||||
doapply, 0, NULL },
|
doapply, CMD_M_PREFIX, NULL },
|
||||||
{ C('x'), "attributes", "show your attributes",
|
{ C('x'), "attributes", "show your attributes",
|
||||||
doattributes, IFBURIED, NULL },
|
doattributes, IFBURIED, NULL },
|
||||||
{ '@', "autopickup", "toggle the 'autopickup' option on/off",
|
{ '@', "autopickup", "toggle the 'autopickup' option on/off",
|
||||||
@@ -1884,7 +1884,7 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ 'D', "droptype", "drop specific item types",
|
{ 'D', "droptype", "drop specific item types",
|
||||||
doddrop, 0, NULL },
|
doddrop, 0, NULL },
|
||||||
{ 'e', "eat", "eat something",
|
{ 'e', "eat", "eat something",
|
||||||
doeat, 0, NULL },
|
doeat, CMD_M_PREFIX, NULL },
|
||||||
{ 'E', "engrave", "engrave writing on the floor",
|
{ 'E', "engrave", "engrave writing on the floor",
|
||||||
doengrave, 0, NULL },
|
doengrave, 0, NULL },
|
||||||
{ M('e'), "enhance", "advance or check weapon and spell skills",
|
{ M('e'), "enhance", "advance or check weapon and spell skills",
|
||||||
@@ -1916,9 +1916,9 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ C('d'), "kick", "kick something",
|
{ C('d'), "kick", "kick something",
|
||||||
dokick, 0, NULL },
|
dokick, 0, NULL },
|
||||||
{ '\\', "known", "show what object types have been discovered",
|
{ '\\', "known", "show what object types have been discovered",
|
||||||
dodiscovered, IFBURIED | GENERALCMD, NULL },
|
dodiscovered, IFBURIED | GENERALCMD | CMD_M_PREFIX, NULL },
|
||||||
{ '`', "knownclass", "show discovered types for one class of objects",
|
{ '`', "knownclass", "show discovered types for one class of objects",
|
||||||
doclassdisco, IFBURIED | GENERALCMD, NULL },
|
doclassdisco, IFBURIED | GENERALCMD | CMD_M_PREFIX, NULL },
|
||||||
{ '\0', "levelchange", "change experience level",
|
{ '\0', "levelchange", "change experience level",
|
||||||
wiz_level_change, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
wiz_level_change, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
||||||
{ '\0', "lightsources", "show mobile light sources",
|
{ '\0', "lightsources", "show mobile light sources",
|
||||||
@@ -1926,7 +1926,7 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ ':', "look", "look at what is here",
|
{ ':', "look", "look at what is here",
|
||||||
dolook, IFBURIED, NULL },
|
dolook, IFBURIED, NULL },
|
||||||
{ M('l'), "loot", "loot a box on the floor",
|
{ M('l'), "loot", "loot a box on the floor",
|
||||||
doloot, AUTOCOMPLETE, NULL },
|
doloot, AUTOCOMPLETE | CMD_M_PREFIX, NULL },
|
||||||
#ifdef DEBUG_MIGRATING_MONS
|
#ifdef DEBUG_MIGRATING_MONS
|
||||||
{ '\0', "migratemons", "migrate N random monsters",
|
{ '\0', "migratemons", "migrate N random monsters",
|
||||||
wiz_migrate_mons, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
wiz_migrate_mons, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
||||||
@@ -1936,7 +1936,7 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ 'N', "name", "same as call; name a monster or object or object type",
|
{ 'N', "name", "same as call; name a monster or object or object type",
|
||||||
docallcmd, IFBURIED | AUTOCOMPLETE, NULL },
|
docallcmd, IFBURIED | AUTOCOMPLETE, NULL },
|
||||||
{ M('o'), "offer", "offer a sacrifice to the gods",
|
{ M('o'), "offer", "offer a sacrifice to the gods",
|
||||||
dosacrifice, AUTOCOMPLETE, NULL },
|
dosacrifice, AUTOCOMPLETE | CMD_M_PREFIX, NULL },
|
||||||
{ 'o', "open", "open a door",
|
{ 'o', "open", "open a door",
|
||||||
doopen, 0, NULL },
|
doopen, 0, NULL },
|
||||||
{ 'O', "options", "show option settings, possibly change them",
|
{ 'O', "options", "show option settings, possibly change them",
|
||||||
@@ -1953,7 +1953,7 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ '|', "perminv", "scroll persistent inventory display",
|
{ '|', "perminv", "scroll persistent inventory display",
|
||||||
doperminv, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
|
doperminv, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
|
||||||
{ ',', "pickup", "pick up things at the current location",
|
{ ',', "pickup", "pick up things at the current location",
|
||||||
dopickup, 0, NULL },
|
dopickup, CMD_M_PREFIX, NULL },
|
||||||
{ '\0', "polyself", "polymorph self",
|
{ '\0', "polyself", "polymorph self",
|
||||||
wiz_polyself, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
wiz_polyself, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
||||||
{ M('p'), "pray", "pray to the gods for help",
|
{ M('p'), "pray", "pray to the gods for help",
|
||||||
@@ -1984,7 +1984,7 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ 'S', "save", "save the game and exit",
|
{ 'S', "save", "save the game and exit",
|
||||||
dosave, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
|
dosave, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
|
||||||
{ 's', "search", "search for traps and secret doors",
|
{ 's', "search", "search for traps and secret doors",
|
||||||
dosearch, IFBURIED, "searching" },
|
dosearch, IFBURIED | CMD_M_PREFIX, "searching" },
|
||||||
{ '*', "seeall", "show all equipment in use",
|
{ '*', "seeall", "show all equipment in use",
|
||||||
doprinuse, IFBURIED, NULL },
|
doprinuse, IFBURIED, NULL },
|
||||||
{ AMULET_SYM, "seeamulet", "show the amulet currently worn",
|
{ AMULET_SYM, "seeamulet", "show the amulet currently worn",
|
||||||
@@ -2027,7 +2027,7 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ 'A', "takeoffall", "remove all armor",
|
{ 'A', "takeoffall", "remove all armor",
|
||||||
doddoremarm, 0, NULL },
|
doddoremarm, 0, NULL },
|
||||||
{ C('t'), "teleport", "teleport around the level",
|
{ C('t'), "teleport", "teleport around the level",
|
||||||
dotelecmd, IFBURIED, NULL },
|
dotelecmd, IFBURIED | CMD_M_PREFIX, NULL },
|
||||||
/* \177 == <del> aka <delete> aka <rubout>; some terminals have an
|
/* \177 == <del> aka <delete> aka <rubout>; some terminals have an
|
||||||
option to swap it with <backspace> so if there's a key labeled
|
option to swap it with <backspace> so if there's a key labeled
|
||||||
<delete> it may or may not actually invoke the #terrain command */
|
<delete> it may or may not actually invoke the #terrain command */
|
||||||
@@ -2043,9 +2043,9 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ '\0', "timeout", "look at timeout queue and hero's timed intrinsics",
|
{ '\0', "timeout", "look at timeout queue and hero's timed intrinsics",
|
||||||
wiz_timeout_queue, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
wiz_timeout_queue, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
||||||
{ M('T'), "tip", "empty a container",
|
{ M('T'), "tip", "empty a container",
|
||||||
dotip, AUTOCOMPLETE, NULL },
|
dotip, AUTOCOMPLETE | CMD_M_PREFIX, NULL },
|
||||||
{ '_', "travel", "travel to a specific location on the map",
|
{ '_', "travel", "travel to a specific location on the map",
|
||||||
dotravel, 0, NULL },
|
dotravel, CMD_M_PREFIX, NULL },
|
||||||
{ M('t'), "turn", "turn undead away",
|
{ M('t'), "turn", "turn undead away",
|
||||||
doturn, IFBURIED | AUTOCOMPLETE, NULL },
|
doturn, IFBURIED | AUTOCOMPLETE, NULL },
|
||||||
{ 'X', "twoweapon", "toggle two-weapon combat",
|
{ 'X', "twoweapon", "toggle two-weapon combat",
|
||||||
@@ -2064,7 +2064,7 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ '\0', "vision", "show vision array",
|
{ '\0', "vision", "show vision array",
|
||||||
wiz_show_vision, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
wiz_show_vision, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
||||||
{ '.', "wait", "rest one move while doing nothing",
|
{ '.', "wait", "rest one move while doing nothing",
|
||||||
donull, IFBURIED, "waiting" },
|
donull, IFBURIED | CMD_M_PREFIX, "waiting" },
|
||||||
{ 'W', "wear", "wear a piece of armor",
|
{ 'W', "wear", "wear a piece of armor",
|
||||||
dowear, 0, NULL },
|
dowear, 0, NULL },
|
||||||
{ '&', "whatdoes", "tell what a command does",
|
{ '&', "whatdoes", "tell what a command does",
|
||||||
@@ -2093,7 +2093,7 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ '\0', "wizintrinsic", "set an intrinsic",
|
{ '\0', "wizintrinsic", "set an intrinsic",
|
||||||
wiz_intrinsic, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
wiz_intrinsic, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
|
||||||
{ C('v'), "wizlevelport", "teleport to another level",
|
{ C('v'), "wizlevelport", "teleport to another level",
|
||||||
wiz_level_tele, IFBURIED | WIZMODECMD, NULL },
|
wiz_level_tele, IFBURIED | WIZMODECMD | CMD_M_PREFIX, NULL },
|
||||||
{ '\0', "wizloaddes", "load and execute a des-file lua script",
|
{ '\0', "wizloaddes", "load and execute a des-file lua script",
|
||||||
wiz_load_splua, IFBURIED | WIZMODECMD | NOFUZZERCMD, NULL },
|
wiz_load_splua, IFBURIED | WIZMODECMD | NOFUZZERCMD, NULL },
|
||||||
{ '\0', "wizloadlua", "load and execute a lua script",
|
{ '\0', "wizloadlua", "load and execute a lua script",
|
||||||
@@ -3296,28 +3296,9 @@ reset_commands(boolean initial)
|
|||||||
|
|
||||||
/* non-movement commands which accept 'm' prefix to request menu operation */
|
/* non-movement commands which accept 'm' prefix to request menu operation */
|
||||||
static boolean
|
static boolean
|
||||||
accept_menu_prefix(int (*cmd_func)(void))
|
accept_menu_prefix(const struct ext_func_tab *ec)
|
||||||
{
|
{
|
||||||
if (cmd_func == dopickup || cmd_func == dotip
|
return (ec && ((ec->flags & CMD_M_PREFIX) != 0));
|
||||||
/* eat, #offer, and apply tinning-kit all use floorfood() to pick
|
|
||||||
an item on floor or in invent; 'm' skips picking from floor
|
|
||||||
(ie, inventory only) rather than request use of menu operation */
|
|
||||||
|| cmd_func == doeat || cmd_func == dosacrifice || cmd_func == doapply
|
|
||||||
/* 'm' for removing saddle from adjacent monster without checking
|
|
||||||
for containers at <u.ux,u.uy> */
|
|
||||||
|| cmd_func == doloot
|
|
||||||
/* offer menu to choose discoveries sort order */
|
|
||||||
|| cmd_func == dodiscovered || cmd_func == doclassdisco
|
|
||||||
/* travel: pop up a menu of interesting targets in view */
|
|
||||||
|| cmd_func == dotravel
|
|
||||||
/* wait and search: allow even if next to a hostile monster */
|
|
||||||
|| cmd_func == donull || cmd_func == dosearch
|
|
||||||
/* wizard mode ^V and ^T */
|
|
||||||
|| cmd_func == wiz_level_tele || cmd_func == dotelecmd
|
|
||||||
/* 'm' prefix allowed for some extended commands */
|
|
||||||
|| cmd_func == doextcmd || cmd_func == doextlist)
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char
|
char
|
||||||
@@ -3551,7 +3532,7 @@ rhack(char *cmd)
|
|||||||
const struct ext_func_tab *ft = g.Cmd.commands[cmd[1] & 0xff];
|
const struct ext_func_tab *ft = g.Cmd.commands[cmd[1] & 0xff];
|
||||||
int (*func)(void) = ft ? ((struct ext_func_tab *) ft)->ef_funct : 0;
|
int (*func)(void) = ft ? ((struct ext_func_tab *) ft)->ef_funct : 0;
|
||||||
|
|
||||||
if (func && accept_menu_prefix(func)) {
|
if (func && accept_menu_prefix(ft)) {
|
||||||
iflags.menu_requested = TRUE;
|
iflags.menu_requested = TRUE;
|
||||||
++cmd;
|
++cmd;
|
||||||
prefix_seen = FALSE;
|
prefix_seen = FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user