summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/birth.cc5
-rw-r--r--src/cmd4.cc5
-rw-r--r--src/dungeon.cc5
-rw-r--r--src/externs.h3
-rw-r--r--src/modules.cc7
-rw-r--r--src/q_library.cc1
-rw-r--r--src/util.cc37
-rw-r--r--src/variable.cc3
-rw-r--r--src/wizard2.cc5
9 files changed, 21 insertions, 50 deletions
diff --git a/src/birth.cc b/src/birth.cc
index 6f93d571..cc42f758 100644
--- a/src/birth.cc
+++ b/src/birth.cc
@@ -2879,11 +2879,8 @@ static bool_ player_birth_aux_auto()
/* Make sure they see everything */
Term_fresh();
- /* Do not wait for a key */
- inkey_scan = TRUE;
-
/* Check for a keypress */
- if (inkey()) break;
+ if (inkey_scan()) break;
}
}
diff --git a/src/cmd4.cc b/src/cmd4.cc
index 8a35dfe1..c2cde07b 100644
--- a/src/cmd4.cc
+++ b/src/cmd4.cc
@@ -1571,11 +1571,8 @@ static void do_cmd_macro_aux(char *buf, bool_ macro_screen)
/* Do not process macros */
inkey_base = TRUE;
- /* Do not wait for keys */
- inkey_scan = TRUE;
-
/* Attempt to read a key */
- i = inkey();
+ i = inkey_scan();
}
/* Terminate */
diff --git a/src/dungeon.cc b/src/dungeon.cc
index 2cc2042a..4e792266 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -4568,11 +4568,8 @@ void process_player(void)
/* Check for "player abort" (semi-efficiently for resting) */
if (running || command_rep || (resting && !(resting & 0x0F)))
{
- /* Do not wait */
- inkey_scan = TRUE;
-
/* Check for a key */
- if (inkey())
+ if (inkey_scan())
{
/* Flush input */
flush();
diff --git a/src/externs.h b/src/externs.h
index 60b69647..ff1133b2 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -151,8 +151,6 @@ extern u16b total_winner;
extern u16b has_won;
extern u16b noscore;
extern bool_ inkey_base;
-extern bool_ inkey_xtra;
-extern bool_ inkey_scan;
extern bool_ inkey_flag;
extern s16b coin_type;
extern bool_ opening_chest;
@@ -1953,6 +1951,7 @@ extern void keymap_init(void);
extern errr macro_add(cptr pat, cptr act);
extern sint macro_find_exact(cptr pat);
extern char inkey(void);
+extern char inkey_scan(void);
extern void display_message(int x, int y, int split, byte color, cptr t);
extern void cmsg_print(byte color, cptr msg);
extern void msg_print(cptr msg);
diff --git a/src/modules.cc b/src/modules.cc
index 059e9200..b152fa0b 100644
--- a/src/modules.cc
+++ b/src/modules.cc
@@ -317,8 +317,7 @@ static bool_ dleft(byte c, cptr str, int y, int o)
Term_redraw_section(a - 1, y, a, y);
a = a + 1;
- inkey_scan = TRUE;
- if (inkey()) {
+ if (inkey_scan()) {
return TRUE;
}
}
@@ -351,8 +350,7 @@ static bool_ dright(byte c, cptr str, int y, int o)
Term_redraw_section(a, y, a + 1, y);
a = a - 1;
- inkey_scan = TRUE;
- if (inkey()) {
+ if (inkey_scan()) {
return TRUE;
}
}
@@ -394,7 +392,6 @@ static bool_ show_intro(intro_text intro_texts[])
/* Wait for key */
Term_putch(0, 0, TERM_DARK, 32);
- inkey_scan = FALSE;
inkey();
/* Continue */
diff --git a/src/q_library.cc b/src/q_library.cc
index b54a9e48..5541da51 100644
--- a/src/q_library.cc
+++ b/src/q_library.cc
@@ -246,7 +246,6 @@ static void library_quest_fill_book()
library_quest_print_spells(first, current);
- inkey_scan = FALSE;
ch = inkey();
dir = get_keymap_dir(ch);
diff --git a/src/util.cc b/src/util.cc
index 3ed9dfa1..37e9f7d0 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -1661,6 +1661,8 @@ static char inkey_aux(void)
*/
static cptr inkey_next = NULL;
+bool_ inkey_flag = FALSE;
+
/*
* Get a keypress from the user.
@@ -1671,11 +1673,6 @@ static cptr inkey_next = NULL;
* before this function returns. Thus they function just like normal
* parameters, except that most calls to this function can ignore them.
*
-* If "inkey_xtra" is TRUE, then all pending keypresses will be flushed,
-* and any macro processing in progress will be aborted. This flag is
-* set by the "flush()" function, which does not actually flush anything
-* itself, but rather, triggers delayed input flushing via "inkey_xtra".
-*
* If "inkey_scan" is TRUE, then we will immediately return "zero" if no
* keypress is available, instead of waiting for a keypress.
*
@@ -1721,7 +1718,7 @@ static cptr inkey_next = NULL;
*
* Hack -- Note the use of "inkey_next" to allow "keymaps" to be processed.
*/
-char inkey(void)
+static char inkey_real(bool_ inkey_scan)
{
int v;
@@ -1734,13 +1731,13 @@ char inkey(void)
term *old = Term;
/* Hack -- Use the "inkey_next" pointer */
- if (inkey_next && *inkey_next && !inkey_xtra)
+ if (inkey_next && *inkey_next)
{
/* Get next character, and advance */
ch = *inkey_next++;
/* Cancel the various "global parameters" */
- inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE;
+ inkey_base = inkey_flag = inkey_scan = FALSE;
/* Accept result */
macro_recorder_add(ch);
@@ -1751,20 +1748,6 @@ char inkey(void)
inkey_next = NULL;
- /* Hack -- handle delayed "flush()" */
- if (inkey_xtra)
- {
- /* End "macro action" */
- parse_macro = FALSE;
-
- /* End "macro trigger" */
- parse_under = FALSE;
-
- /* Forget old keypresses */
- Term_flush();
- }
-
-
/* Access cursor state */
(void)Term_get_cursor(&v);
@@ -1927,7 +1910,7 @@ char inkey(void)
/* Cancel the various "global parameters" */
- inkey_base = inkey_xtra = inkey_flag = inkey_scan = FALSE;
+ inkey_base = inkey_flag = FALSE;
/* Return the keypress */
@@ -1935,6 +1918,14 @@ char inkey(void)
return (ch);
}
+char inkey(void) {
+ return inkey_real(FALSE);
+}
+
+char inkey_scan() {
+ return inkey_real(TRUE);
+}
+
/*
* Hack -- flush
*/
diff --git a/src/variable.cc b/src/variable.cc
index 289b9c9b..16eda4dc 100644
--- a/src/variable.cc
+++ b/src/variable.cc
@@ -112,9 +112,6 @@ u16b has_won; /* Semi-Hack -- Game has been won */
u16b noscore; /* Track various "cheating" conditions */
bool_ inkey_base; /* See the "inkey()" function */
-bool_ inkey_xtra; /* See the "inkey()" function */
-bool_ inkey_scan; /* See the "inkey()" function */
-bool_ inkey_flag; /* See the "inkey()" function */
s16b coin_type; /* Hack -- force coin type */
diff --git a/src/wizard2.cc b/src/wizard2.cc
index b6d6ca2d..6e86542c 100644
--- a/src/wizard2.cc
+++ b/src/wizard2.cc
@@ -968,11 +968,8 @@ static void wiz_statistics(object_type *o_ptr)
/* Output every few rolls */
if ((i < 100) || (i % 100 == 0))
{
- /* Do not wait */
- inkey_scan = TRUE;
-
/* Allow interupt */
- if (inkey())
+ if (inkey_scan())
{
/* Flush */
flush();