do-again vs yn_function()
This fixes the impossible from yn_function() for ^A after Z. One call to yn_function stored the spell letter for do-again and then another call was unintentionally using that when getting a y/n response for askchain() while using menustyle:Traditional [when spell was identify and eligible objects needed confirmation about whether to be ID'd]. Fixing that seemed to break #pray so the paranoid_confirm routine has been changed to not rely on canned input, even for queries where the player hasn't specified that confirmation be required. Behavior of ^A might be different in unexpected ways, but it wasn't working correctly before.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1572 $ $NHDT-Date: 1762577372 2025/11/07 20:49:32 $
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1573 $ $NHDT-Date: 1762680996 2025/11/09 01:36:36 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -2137,6 +2137,9 @@ timer sanity check for melting ice gave false complaint about non-ice for
|
||||
mhitm_ad_phys() was not applying Half_physical_damage when hero was target
|
||||
throwing crystal plate mail or helm of brilliance up against the ceiling could
|
||||
result in the item being cracked and then vanishing
|
||||
yn_function (used all over the place) sometimes triggered an impossible()
|
||||
during do-again (^A) processing [ongoing revisions; more are probably
|
||||
needed; listed here in case ^A behavior changes]
|
||||
|
||||
|
||||
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository
|
||||
|
||||
12
src/cmd.c
12
src/cmd.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 cmd.c $NHDT-Date: 1736401574 2025/01/08 21:46:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.744 $ */
|
||||
/* NetHack 3.7 cmd.c $NHDT-Date: 1762680996 2025/11/09 01:36:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.755 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -5260,7 +5260,7 @@ yn_function(
|
||||
query = qbuf;
|
||||
}
|
||||
|
||||
if ((cmdq = cmdq_pop()) != 0) {
|
||||
if (addcmdq && (cmdq = cmdq_pop()) != 0) {
|
||||
cq = *cmdq;
|
||||
free(cmdq);
|
||||
} else {
|
||||
@@ -5323,7 +5323,7 @@ yn_function(
|
||||
it is most likely caused by saving a keystroke that was just used
|
||||
to answer a context-sensitive prompt, then using the do-again
|
||||
command with context that has changed */
|
||||
if (resp && res && !strchr(resp, res)) {
|
||||
if (resp && *resp && res && !strchr(resp, res)) {
|
||||
/* this probably needs refinement since caller is expecting something
|
||||
within 'resp' and ESC won't be (it could be present, but as a flag
|
||||
for unshown possibilities rather than as acceptable input) */
|
||||
@@ -5405,9 +5405,11 @@ paranoid_ynq(
|
||||
/* for empty input, return value c will already be 'n' */
|
||||
} while (ParanoidConfirm && strcmpi(ans, "no") && --trylimit);
|
||||
} else if (accept_q) {
|
||||
c = ynq(prompt); /* 'y', 'n', or 'q' */
|
||||
/* 'y', 'n', or 'q' */
|
||||
c = yn_function(prompt, ynqchars, 'n', FALSE);
|
||||
} else {
|
||||
c = y_n(prompt); /* 'y' or 'n' */
|
||||
/* 'y' or 'n' */
|
||||
c = yn_function(prompt, ynchars, 'n', FALSE);
|
||||
}
|
||||
if (c != 'y' && (c != 'q' || !accept_q))
|
||||
c = 'n';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 invent.c $NHDT-Date: 1737384766 2025/01/20 06:52:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.531 $ */
|
||||
/* NetHack 3.7 invent.c $NHDT-Date: 1762680996 2025/11/09 01:36:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.543 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -2445,8 +2445,11 @@ askchain(
|
||||
ininv ? safeq_xprname : doname,
|
||||
ininv ? safeq_shortxprname : ansimpleoname,
|
||||
"item");
|
||||
sym = (takeoff || ident || otmp->quan < 2L) ? nyaq(qbuf)
|
||||
: nyNaq(qbuf);
|
||||
/* nyaq(qbuf) or nyNaq(qbuf), bypassing canned input for ^A */
|
||||
sym = yn_function(qbuf,
|
||||
(takeoff || ident || otmp->quan < 2L)
|
||||
? ynaqchars : ynNaqchars,
|
||||
'n', FALSE);
|
||||
} else
|
||||
sym = 'y';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 pray.c $NHDT-Date: 1727250729 2024/09/25 07:52:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.220 $ */
|
||||
/* NetHack 3.7 pray.c $NHDT-Date: 1762680996 2025/11/09 01:36:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.244 $ */
|
||||
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2207,12 +2207,12 @@ dopray(void)
|
||||
if (ParanoidPray) {
|
||||
ok = paranoid_query(ParanoidConfirm,
|
||||
"Are you sure you want to pray?");
|
||||
|
||||
#if 0
|
||||
/* clear command recall buffer; otherwise ^A to repeat p(ray) would
|
||||
do so without confirmation (if 'ok') or do nothing (if '!ok') */
|
||||
cmdq_clear(CQ_REPEAT);
|
||||
cmdq_add_ec(CQ_REPEAT, dopray);
|
||||
|
||||
#endif
|
||||
if (!ok) /* declined the "are you sure?" confirmation */
|
||||
return ECMD_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user