long *);
static void contained_stats(winid, const char *, 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 char here_cmd_menu(boolean);
func = extcmdlist[idx].ef_funct;
if (!can_do_extcmd(&extcmdlist[idx]))
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.",
visctrl(g.Cmd.spkeys[NHKF_REQMENU]),
extcmdlist[idx].ef_txt);
MENU_ITEMFLAGS_NONE);
return (char *) 0;
} else {
- boolean mprefix = accept_menu_prefix(efp->ef_funct),
+ boolean mprefix = accept_menu_prefix(efp),
autocomplete = (efp->flags & AUTOCOMPLETE) != 0;
char *p = Abuf;
such as ^O/#overview and C/N/#name */
struct ext_func_tab extcmdlist[] = {
{ '#', "#", "perform an extended command",
- doextcmd, IFBURIED | GENERALCMD, NULL },
+ doextcmd, IFBURIED | GENERALCMD | CMD_M_PREFIX, NULL },
{ M('?'), "?", "list all extended commands",
- doextlist, IFBURIED | AUTOCOMPLETE | GENERALCMD, NULL },
+ doextlist, IFBURIED | AUTOCOMPLETE | GENERALCMD | CMD_M_PREFIX, NULL },
{ M('a'), "adjust", "adjust inventory letters",
doorganize, IFBURIED | AUTOCOMPLETE, NULL },
{ M('A'), "annotate", "name current level",
donamelevel, IFBURIED | AUTOCOMPLETE, NULL },
{ 'a', "apply", "apply (use) a tool (pick-axe, key, lamp...)",
- doapply, 0, NULL },
+ doapply, CMD_M_PREFIX, NULL },
{ C('x'), "attributes", "show your attributes",
doattributes, IFBURIED, NULL },
{ '@', "autopickup", "toggle the 'autopickup' option on/off",
{ 'D', "droptype", "drop specific item types",
doddrop, 0, NULL },
{ 'e', "eat", "eat something",
- doeat, 0, NULL },
+ doeat, CMD_M_PREFIX, NULL },
{ 'E', "engrave", "engrave writing on the floor",
doengrave, 0, NULL },
{ M('e'), "enhance", "advance or check weapon and spell skills",
{ C('d'), "kick", "kick something",
dokick, 0, NULL },
{ '\\', "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",
- doclassdisco, IFBURIED | GENERALCMD, NULL },
+ doclassdisco, IFBURIED | GENERALCMD | CMD_M_PREFIX, NULL },
{ '\0', "levelchange", "change experience level",
wiz_level_change, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ '\0', "lightsources", "show mobile light sources",
{ ':', "look", "look at what is here",
dolook, IFBURIED, NULL },
{ M('l'), "loot", "loot a box on the floor",
- doloot, AUTOCOMPLETE, NULL },
+ doloot, AUTOCOMPLETE | CMD_M_PREFIX, NULL },
#ifdef DEBUG_MIGRATING_MONS
{ '\0', "migratemons", "migrate N random monsters",
wiz_migrate_mons, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ 'N', "name", "same as call; name a monster or object or object type",
docallcmd, IFBURIED | AUTOCOMPLETE, NULL },
{ M('o'), "offer", "offer a sacrifice to the gods",
- dosacrifice, AUTOCOMPLETE, NULL },
+ dosacrifice, AUTOCOMPLETE | CMD_M_PREFIX, NULL },
{ 'o', "open", "open a door",
doopen, 0, NULL },
{ 'O', "options", "show option settings, possibly change them",
{ '|', "perminv", "scroll persistent inventory display",
doperminv, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
{ ',', "pickup", "pick up things at the current location",
- dopickup, 0, NULL },
+ dopickup, CMD_M_PREFIX, NULL },
{ '\0', "polyself", "polymorph self",
wiz_polyself, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ M('p'), "pray", "pray to the gods for help",
{ 'S', "save", "save the game and exit",
dosave, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
{ 's', "search", "search for traps and secret doors",
- dosearch, IFBURIED, "searching" },
+ dosearch, IFBURIED | CMD_M_PREFIX, "searching" },
{ '*', "seeall", "show all equipment in use",
doprinuse, IFBURIED, NULL },
{ AMULET_SYM, "seeamulet", "show the amulet currently worn",
{ 'A', "takeoffall", "remove all armor",
doddoremarm, 0, NULL },
{ 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
option to swap it with <backspace> so if there's a key labeled
<delete> it may or may not actually invoke the #terrain command */
{ '\0', "timeout", "look at timeout queue and hero's timed intrinsics",
wiz_timeout_queue, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ M('T'), "tip", "empty a container",
- dotip, AUTOCOMPLETE, NULL },
+ dotip, AUTOCOMPLETE | CMD_M_PREFIX, NULL },
{ '_', "travel", "travel to a specific location on the map",
- dotravel, 0, NULL },
+ dotravel, CMD_M_PREFIX, NULL },
{ M('t'), "turn", "turn undead away",
doturn, IFBURIED | AUTOCOMPLETE, NULL },
{ 'X', "twoweapon", "toggle two-weapon combat",
{ '\0', "vision", "show vision array",
wiz_show_vision, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ '.', "wait", "rest one move while doing nothing",
- donull, IFBURIED, "waiting" },
+ donull, IFBURIED | CMD_M_PREFIX, "waiting" },
{ 'W', "wear", "wear a piece of armor",
dowear, 0, NULL },
{ '&', "whatdoes", "tell what a command does",
{ '\0', "wizintrinsic", "set an intrinsic",
wiz_intrinsic, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ 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",
wiz_load_splua, IFBURIED | WIZMODECMD | NOFUZZERCMD, NULL },
{ '\0', "wizloadlua", "load and execute a lua script",
/* non-movement commands which accept 'm' prefix to request menu operation */
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
- /* 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;
+ return (ec && ((ec->flags & CMD_M_PREFIX) != 0));
}
char
const struct ext_func_tab *ft = g.Cmd.commands[cmd[1] & 0xff];
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;
++cmd;
prefix_seen = FALSE;