summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-02 08:06:33 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-02 08:06:33 +0000
commitaeb8693fded3aa3d0810bd6af7caea46c7bcffbf (patch)
tree69333c3f482ea51b1aa009ac6e9a9d1679208e6f
parente9183b0754c65eccbb6edb43f73f8657763bcda7 (diff)
downloadcrawl-ref-aeb8693fded3aa3d0810bd6af7caea46c7bcffbf.tar.gz
crawl-ref-aeb8693fded3aa3d0810bd6af7caea46c7bcffbf.zip
1622385: there is now a Confirm keymap context for yesno() and
yesnoquit(). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1714 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/macro.cc19
-rw-r--r--crawl-ref/source/macro.h1
-rw-r--r--crawl-ref/source/stuff.cc4
3 files changed, 17 insertions, 7 deletions
diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc
index 0deb31ae04..264958a993 100644
--- a/crawl-ref/source/macro.cc
+++ b/crawl-ref/source/macro.cc
@@ -63,6 +63,7 @@ static macromap *all_maps[] =
&Keymaps[KC_DEFAULT],
&Keymaps[KC_LEVELMAP],
&Keymaps[KC_TARGETING],
+ &Keymaps[KC_CONFIRM],
&Macros,
};
@@ -661,7 +662,9 @@ void macro_add_query( void )
KeymapContext keymc = KC_DEFAULT;
mesclr();
- mpr("(m)acro, keymap [(k) default, (x) level-map or (t)argeting], (s)ave?",
+ mpr("(m)acro, keymap "
+ "[(k) default, (x) level-map, (t)argeting, (c)onfirm], "
+ "(s)ave?",
MSGCH_PROMPT);
input = m_getch();
input = tolower( input );
@@ -680,6 +683,11 @@ void macro_add_query( void )
keymap = true;
keymc = KC_TARGETING;
}
+ else if (input == 'c')
+ {
+ keymap = true;
+ keymc = KC_CONFIRM;
+ }
else if (input == 'm')
keymap = false;
else if (input == 's')
@@ -698,10 +706,11 @@ void macro_add_query( void )
macromap &mapref = (keymap ? Keymaps[keymc] : Macros);
mprf(MSGCH_PROMPT, "Input %s%s trigger key: ",
- keymap ? (keymc == KC_DEFAULT ? "default " :
- keymc == KC_LEVELMAP ? "level-map "
- : "targeting ")
- : "",
+ keymap ? (keymc == KC_DEFAULT ? "default " :
+ keymc == KC_LEVELMAP ? "level-map " :
+ keymc == KC_TARGETING ? "targeting " :
+ keymc == KC_CONFIRM ? "confirm " :
+ "buggy") : "",
(keymap ? "keymap" : "macro") );
keyseq key = getch_mul();
diff --git a/crawl-ref/source/macro.h b/crawl-ref/source/macro.h
index e5b507d531..ff1c01b076 100644
--- a/crawl-ref/source/macro.h
+++ b/crawl-ref/source/macro.h
@@ -25,6 +25,7 @@ enum KeymapContext {
KC_DEFAULT, // For no-arg getchm(), must be zero.
KC_LEVELMAP, // When in the 'X' level map
KC_TARGETING, // Only during 'x' and other targeting modes
+ KC_CONFIRM, // When being asked y/n/q questions
KC_CONTEXT_COUNT // Must always be the last
};
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 5c56004c6a..615a21a18b 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -599,7 +599,7 @@ bool yesno( const char *str, bool safe, int safeanswer, bool clear_after,
if ( !noprompt )
mpr(str, MSGCH_PROMPT);
- int tmp = getch();
+ int tmp = getchm(KC_CONFIRM);
if ((tmp == ' ' || tmp == 27 || tmp == '\r' || tmp == '\n')
&& safeanswer)
@@ -632,7 +632,7 @@ int yesnoquit( const char* str, bool safe, int safeanswer, bool clear_after )
{
mpr(str, MSGCH_PROMPT);
- int tmp = getch();
+ int tmp = getchm(KC_CONFIRM);
if ( tmp == ESCAPE || tmp == 'q' || tmp == 'Q' )
return -1;