additional paranoia (trunk only)

A couple of extensions to the paranoid_confirmation option:

1) add paranoid_confirmation:Confirm -- setting this means that any
prompt where the other paranoid_confirm flags have been set to require
a yes response instead of y to confirm also require explicit no rather
than arbitrary non-yes to reject.  It will reprompt if you don't answer
"yes" or "no" (unless you use ESC, which is treated the same as "no").

2) add paranoid_confirmation:bones -- control whether the "save bones?"
prompt in wizard mode requires yes instead of just y.  The original user-
developed paranoid_confirm patch required yes unconditionally here, and
I left that out thinking it was undesireable.  But after testing the
"your body rises from the dead as <undead>..." fix a couple of days ago,
where you now get an extra message and consequent --More-- prompt just
before "save bones?", I've changed my mind about its usefulness, provided
that it's settable rather than unconditional.

     Handling paranoid_confirmation:bones outside of wizard mode is a
bit tricky.  Right now, it can still be seen via 'O' if it has been set
in NETHACKOPTIONS, but it won't show up in the menu if you use 'O' to
interactively change the value of paranoid_confirmation.  I'm not sure
whether that's the right way to go; it might be better to let non-wizard
users uselessly toggle it on and off rather than only partially hide it.
Or maybe it should be hidden from the current value even when it's set.
Or decline to set it in first place, despite external option settings.
This commit is contained in:
nethack.rankin
2011-04-25 03:29:49 +00:00
parent cb43f6fce5
commit 8a66aa38df
9 changed files with 100 additions and 52 deletions

View File

@@ -3651,15 +3651,27 @@ boolean be_paranoid;
const char *prompt;
{
char qbuf[QBUFSZ], ans[BUFSZ];
const char *responsetype, *promptprefix = "";
boolean confirmed_ok;
/* when paranoid, player must respond with "yes" rather than just 'y'
to give the go-ahead for this query; default is "no", obviously */
to give the go-ahead for this query; default is "no" unless the
ParanoidConfirm flag is set in which case there's no default */
if (be_paranoid) {
Sprintf(qbuf, "%s (yes) [no]", prompt);
getlin(qbuf, ans);
(void) mungspaces(ans);
confirmed_ok = !strcmpi(ans, "yes");
/* in addition to being paranoid about this particular
query, we might be even more paranoid about all paranoia
responses (ie, ParanoidConfirm is set) in which case we
require "no" to reject in addition to "yes" to confirm
(except we won't loop if respose is ESC; it means no) */
responsetype = ParanoidConfirm ? "(yes|no)" : "(yes) [no]";
do {
Sprintf(qbuf, "%s%s %s", promptprefix, prompt, responsetype);
getlin(qbuf, ans);
(void) mungspaces(ans);
confirmed_ok = !strcmpi(ans, "yes");
if (confirmed_ok || *ans == '\033') break;
promptprefix = "\"Yes\" or \"No\": ";
} while (ParanoidConfirm && strcmpi(ans, "no"));
} else
confirmed_ok = (yn(prompt) == 'y');