Merge branch 'NetHack-3.6' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6

This commit is contained in:
Bart House
2019-10-26 20:12:09 -07:00
2 changed files with 18 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.147 $ $NHDT-Date: 1572070254 2019/10/26 06:10:54 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ $NHDT-Date: 1572141706 2019/10/27 02:01:46 $
This fixes36.3 file is here to capture information about updates in the 3.6.x This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however, lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -255,6 +255,8 @@ EDIT_GETLIN: when naming an object or a monster use the existing name, if
EDIT_GETLIN: using 'O' to set message types or menu colors was overloading the EDIT_GETLIN: using 'O' to set message types or menu colors was overloading the
answer buffer with other stuff, resulting in bogus default response answer buffer with other stuff, resulting in bogus default response
during repeat prompting during repeat prompting
EDIT_GETLIN: for paranoid confirmation, if answer was neither "yes" nor "no",
don't supply the rejected answer as the default when retrying
curses: very tall menus tried to use selector characters a-z, A-Z, and 0-9, curses: very tall menus tried to use selector characters a-z, A-Z, and 0-9,
but 0-9 should be reserved for counts and if the display was tall but 0-9 should be reserved for counts and if the display was tall
enough for more than 62 entries, arbitrary ASCII punctuation got used enough for more than 62 entries, arbitrary ASCII punctuation got used

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1565574994 2019/08/12 01:56:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.343 $ */ /* NetHack 3.6 cmd.c $NHDT-Date: 1572141702 2019/10/27 02:01:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.347 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -6045,19 +6045,27 @@ const char *prompt;
to give the go-ahead for this query; default is "no" unless the to give the go-ahead for this query; default is "no" unless the
ParanoidConfirm flag is set in which case there's no default */ ParanoidConfirm flag is set in which case there's no default */
if (be_paranoid) { if (be_paranoid) {
char qbuf[QBUFSZ], ans[BUFSZ] = DUMMY; char pbuf[BUFSZ], qbuf[QBUFSZ], ans[BUFSZ];
const char *promptprefix = "", *responsetype = ParanoidConfirm const char *promptprefix = "",
? "(yes|no)" *responsetype = ParanoidConfirm ? "(yes|no)" : "(yes) [no]";
: "(yes) [no]"; int k, trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */
int trylimit = 6; /* 1 normal, 5 more with "Yes or No:" prefix */
copynchars(pbuf, prompt, BUFSZ - 1);
/* in addition to being paranoid about this particular /* in addition to being paranoid about this particular
query, we might be even more paranoid about all paranoia query, we might be even more paranoid about all paranoia
responses (ie, ParanoidConfirm is set) in which case we responses (ie, ParanoidConfirm is set) in which case we
require "no" to reject in addition to "yes" to confirm require "no" to reject in addition to "yes" to confirm
(except we won't loop if response is ESC; it means no) */ (except we won't loop if response is ESC; it means no) */
do { do {
Sprintf(qbuf, "%s%s %s", promptprefix, prompt, responsetype); /* make sure we won't overflow a QBUFSZ sized buffer */
k = (int) (strlen(promptprefix) + 1 + strlen(responsetype));
if ((int) strlen(pbuf) + k > QBUFSZ - 1) {
/* chop off some at the end */
Strcpy(pbuf + (QBUFSZ - 1) - k - 4, "...?"); /* -4: "...?" */
}
Sprintf(qbuf, "%s%s %s", promptprefix, pbuf, responsetype);
*ans = '\0';
getlin(qbuf, ans); getlin(qbuf, ans);
(void) mungspaces(ans); (void) mungspaces(ans);
confirmed_ok = !strcmpi(ans, "yes"); confirmed_ok = !strcmpi(ans, "yes");