-/* NetHack 3.7 decl.h $NHDT-Date: 1607641577 2020/12/10 23:06:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.248 $ */
+/* NetHack 3.7 decl.h $NHDT-Date: 1627408982 2021/07/27 18:03:02 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.265 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2007. */
/* NetHack may be freely redistributed. See license for details. */
int in_paniclog;
#endif
int wizkit_wishing;
+ /* getting_a_command: only used for ALTMETA config to process ESC, but
+ present and updated unconditionally; set by parse() when requesting
+ next command keystroke, reset by readchar() as it returns a key */
+ int getting_a_command;
};
/* Flags for controlling uptodate */
-/* NetHack 3.7 cmd.c $NHDT-Date: 1621377703 2021/05/18 22:41:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.464 $ */
+/* NetHack 3.7 cmd.c $NHDT-Date: 1627408993 2021/07/27 18:03:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.481 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
/* for rejecting #if !SHELL, !SUSPEND */
static const char cmdnotavail[] = "'%s' command not available.";
-/* only needed for #if ALTMETA config but present unconditionally */
-static boolean getting_cmd = FALSE; /* True when parse() gets next command */
-
static int
doprev_message(void)
{
g.context.move = 1;
flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
- getting_cmd = TRUE; /* affects readchar() behavior if the 'altmeta'
- * option is On; reset to False by readchar() */
+ g.program_state.getting_a_command = 1; /* affects readchar() behavior for
+ * ESC iff 'altmeta' option is On;
+ * reset to 0 by readchar() */
if (!g.Cmd.num_pad || (foo = readchar()) == g.Cmd.spkeys[NHKF_COUNT]) {
foo = get_count((char *) 0, '\0', LARGEST_INT,
&g.command_count, FALSE);
#endif
sym = '\033';
#ifdef ALTMETA
- } else if (sym == '\033' && iflags.altmeta && getting_cmd) {
+ } else if (sym == '\033' && iflags.altmeta
+ && g.program_state.getting_a_command) {
/* iflags.altmeta: treat two character ``ESC c'' as single `M-c' but
only when we're called by parse() [possibly via get_count()] */
sym = *readchar_queue ? *readchar_queue++ : pgetchar();
readchar_queue = click_to_cmd(*x, *y, *mod);
sym = *readchar_queue++;
}
- getting_cmd = FALSE; /* next readchar() will be for an ordinary char
- * unless parse() sets this back to True */
+ g.program_state.getting_a_command = 0; /* next readchar() will be for an
+ * ordinary char unless parse()
+ * sets this back to 1 */
return (char) sym;
}