paranoid-pray vs do-again
If paranoid_confirm settings include praying, don't put the answer to "are you sure you want to pray?" into the do-again buffer where ^A would use it to ignore confirmation if prayer is repeated. And for wizard mode, when confirmation is 'y' then the answer to "force the gods to be pleased?" has to be suppressed from the do-again buffer too or it would be used by subsequent ^A to answer "are you sure?". This is basically a band-aid just for #pray. There are probably other confirmations that should be suppressed from do-again instead of being reusable. The rest of the paranoid_confirm ones should be ok because they require "yes" and that doesn't end up in the do-again buffer, but there are bound to be other confirmations that shouldn't automatically be re-used during repetition.
This commit is contained in:
@@ -453,6 +453,8 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */
|
||||
#define nyaq(query) yn_function(query, ynaqchars, 'n', TRUE)
|
||||
#define nyNaq(query) yn_function(query, ynNaqchars, 'n', TRUE)
|
||||
#define ynNaq(query) yn_function(query, ynNaqchars, 'y', TRUE)
|
||||
/* YN() is same as yn() except doesn't save the response in do-again buffer */
|
||||
#define YN(query) yn_function(query, ynchars, 'n', FALSE)
|
||||
|
||||
/* Macros for scatter */
|
||||
#define VIS_EFFECTS 0x01 /* display visual effects */
|
||||
|
||||
17
src/pray.c
17
src/pray.c
@@ -2016,8 +2016,13 @@ pray_revive(void)
|
||||
int
|
||||
dopray(void)
|
||||
{
|
||||
/* Confirm accidental slips of Alt-P */
|
||||
if (ParanoidPray && yn("Are you sure you want to pray?") != 'y')
|
||||
/*
|
||||
* If ParanoidPray is set, confirm prayer to avoid accidental slips
|
||||
* of Alt+p.
|
||||
* YN(): don't save response in do-again buffer since if it is 'y',
|
||||
* ^A would bypass confirmation, or if 'n', ^A would be pointless.
|
||||
*/
|
||||
if (ParanoidPray && YN("Are you sure you want to pray?") != 'y')
|
||||
return ECMD_OK;
|
||||
|
||||
if (!u.uconduct.gnostic++)
|
||||
@@ -2033,7 +2038,13 @@ dopray(void)
|
||||
return ECMD_OK;
|
||||
|
||||
if (wizard && g.p_type >= 0) {
|
||||
if (yn("Force the gods to be pleased?") == 'y') {
|
||||
static const char forcesuccess[] = "Force the gods to be pleased?";
|
||||
|
||||
/* if we asked "are you sure?" above we suppressed the response
|
||||
from the do-again buffer, so need to suppress this response too;
|
||||
otherwise subsequent ^A would use this answer for "are you sure?"
|
||||
and bypass confirmation */
|
||||
if ((ParanoidPray ? YN(forcesuccess) : yn(forcesuccess)) == 'y') {
|
||||
u.ublesscnt = 0;
|
||||
if (u.uluck < 0)
|
||||
u.uluck = 0;
|
||||
|
||||
Reference in New Issue
Block a user