static int dotherecmdmenu(void);
static int doprev_message(void);
static int timed_occupation(void);
+static boolean can_do_extcmd(const struct ext_func_tab *);
static int doextcmd(void);
static int dotravel(void);
static int doterrain(void);
return;
}
+static boolean
+can_do_extcmd(const struct ext_func_tab *extcmd)
+{
+ int ecflags = extcmd->flags;
+
+ if (!wizard && (ecflags & WIZMODECMD)) {
+ You_cant("do that!");
+ return FALSE;
+ } else if (u.uburied && !(ecflags & IFBURIED)) {
+ You_cant("do that while you are buried!");
+ return FALSE;
+ } else if (iflags.debug_fuzzer && (ecflags & NOFUZZERCMD)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
/* here after # - now read a full-word command */
static int
doextcmd(void)
return 0; /* quit */
func = extcmdlist[idx].ef_funct;
- if (!wizard && (extcmdlist[idx].flags & WIZMODECMD)) {
- You("can't do that.");
+ if (!can_do_extcmd(&extcmdlist[idx]))
return 0;
- }
if (iflags.menu_requested && !accept_menu_prefix(func)) {
pline("'%s' prefix has no effect for the %s command.",
visctrl(g.Cmd.spkeys[NHKF_REQMENU]),
int
enter_explore_mode(void)
{
- if (iflags.debug_fuzzer)
- return 0;
-
if (discover) {
You("are already in explore mode.");
} else {
static int
wiz_load_lua(void)
{
- if (wizard && !iflags.debug_fuzzer) {
+ if (wizard) {
char buf[BUFSZ];
buf[0] = '\0';
static int
wiz_load_splua(void)
{
- if (wizard && !iflags.debug_fuzzer) {
+ if (wizard) {
boolean was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz);
char buf[BUFSZ];
int ridx;
/* #exploremode should be flagged AUTOCOMPETE but that would negatively
impact frequently used #enhance by making #e become ambiguous */
{ M('X'), "exploremode", "enter explore (discovery) mode",
- enter_explore_mode, IFBURIED | GENERALCMD, NULL },
+ enter_explore_mode, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
{ 'f', "fire", "fire ammunition from quiver",
dofire, 0, NULL },
{ M('f'), "force", "force a lock",
{ 'p', "pay", "pay your shopping bill",
dopay, 0, NULL },
{ '|', "perminv", "scroll persistent inventory display",
- doperminv, IFBURIED | GENERALCMD, NULL },
+ doperminv, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
{ ',', "pickup", "pick up things at the current location",
dopickup, 0, NULL },
{ '\0', "polyself", "polymorph self",
{ 'q', "quaff", "quaff (drink) something",
dodrink, 0, NULL },
{ '\0', "quit", "exit without saving current game",
- done2, IFBURIED | AUTOCOMPLETE | GENERALCMD, NULL },
+ done2, IFBURIED | AUTOCOMPLETE | GENERALCMD | NOFUZZERCMD, NULL },
{ 'Q', "quiver", "select ammunition for quiver",
dowieldquiver, 0, NULL },
{ 'r', "read", "read a scroll or spellbook",
{ M('r'), "rub", "rub a lamp or a stone",
dorub, AUTOCOMPLETE, NULL },
{ 'S', "save", "save the game and exit",
- dosave, IFBURIED | GENERALCMD, NULL },
+ dosave, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
{ 's', "search", "search for traps and secret doors",
dosearch, IFBURIED, "searching" },
{ '*', "seeall", "show all equipment in use",
{ WEAPON_SYM, "seeweapon", "show the weapon currently wielded",
doprwep, IFBURIED, NULL },
{ '!', "shell", "leave game to enter a sub-shell ('exit' to come back)",
- dosh_core, (IFBURIED | GENERALCMD
+ dosh_core, (IFBURIED | GENERALCMD | NOFUZZERCMD
#ifndef SHELL
| CMD_NOT_AVAILABLE
#endif /* SHELL */
{ '\0', "stats", "show memory statistics",
wiz_show_stats, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
{ C('z'), "suspend", "push game to background ('fg' to come back)",
- dosuspend_core, (IFBURIED | GENERALCMD
+ dosuspend_core, (IFBURIED | GENERALCMD | NOFUZZERCMD
#ifndef SUSPEND
| CMD_NOT_AVAILABLE
#endif /* SUSPEND */
{ C('v'), "wizlevelport", "teleport to another level",
wiz_level_tele, IFBURIED | WIZMODECMD, NULL },
{ '\0', "wizloaddes", "load and execute a des-file lua script",
- wiz_load_splua, IFBURIED | WIZMODECMD, NULL },
+ wiz_load_splua, IFBURIED | WIZMODECMD | NOFUZZERCMD, NULL },
{ '\0', "wizloadlua", "load and execute a lua script",
- wiz_load_lua, IFBURIED | WIZMODECMD, NULL },
+ wiz_load_lua, IFBURIED | WIZMODECMD | NOFUZZERCMD, NULL },
{ '\0', "wizmakemap", "recreate the current level",
wiz_makemap, IFBURIED | WIZMODECMD, NULL },
{ C('f'), "wizmap", "map the level",
/* current - use *cmd to directly index cmdlist array */
if (tlist != 0) {
- if (!wizard && (tlist->flags & WIZMODECMD)) {
- You_cant("do that!");
- res = 0;
- cmdq_clear();
- } else if (u.uburied && !(tlist->flags & IFBURIED)) {
- You_cant("do that while you are buried!");
+ if (!can_do_extcmd(tlist)) {
res = 0;
cmdq_clear();
} else {
g.last_command_count = g.command_count;
}
- if (iflags.debug_fuzzer /* if fuzzing, override '!' and ^Z */
- && (g.Cmd.commands[foo & 0x0ff]
- && (g.Cmd.commands[foo & 0x0ff]->ef_funct == dosuspend_core
- || g.Cmd.commands[foo & 0x0ff]->ef_funct == dosh_core)))
- foo = g.Cmd.spkeys[NHKF_ESC];
-
if (foo == g.Cmd.spkeys[NHKF_ESC]) { /* esc cancels count (TH) */
clear_nhwindow(WIN_MESSAGE);
g.command_count = 0;