paranoid_confirmation [expanded user patch] (trunk only; 2 of 2)

[Short writeup; see 'cvs log' of flag.h or options.c for the long one.]

     This is a reworking of user contributed patch known as Paranoid_Quit.

     Add a new compound option, paranoid_confirmation, accepting a space
separated list of values "quit die attack pray Remove"; default is "pray".
paranoid:quit   - yes vs y for "really quit?" and "enter explore mode?"
paranoid:die    - yes vs y for "die?" in explore mode or wizard mode
paranoid:attack - yes vs y for "really attack <peacful monster>?"
paranoid:pray   - y to pray; supersedes prayconfirm boolean; on by default
paranoid:Remove - always issue an inventory prompt for 'R' an 'T', even
  when only one applicable item is currently worn.
This commit is contained in:
nethack.rankin
2011-03-05 10:09:48 +00:00
parent fa6098bfd4
commit 2ec7b5d2f6
11 changed files with 126 additions and 35 deletions

View File

@@ -503,19 +503,26 @@ domonability(VOID_ARGS)
int
enter_explore_mode(VOID_ARGS)
{
if(!discover && !wizard) {
pline("Beware! From explore mode there will be no return to normal game.");
if (yn("Do you want to enter explore mode?") == 'y') {
clear_nhwindow(WIN_MESSAGE);
You("are now in non-scoring explore mode.");
discover = TRUE;
}
else {
clear_nhwindow(WIN_MESSAGE);
pline("Resuming normal game.");
}
if (wizard) {
#ifdef WIZARD
You("are in debug mode.");
#endif
} else if (discover) {
You("are already in explore mode.");
} else {
pline(
"Beware! From explore mode there will be no return to normal game.");
if (paranoid_query(ParanoidQuit,
"Do you want to enter explore mode?")) {
clear_nhwindow(WIN_MESSAGE);
You("are now in non-scoring explore mode.");
discover = TRUE;
} else {
clear_nhwindow(WIN_MESSAGE);
pline("Resuming normal game.");
}
return 0;
}
return 0;
}
#ifdef DUNGEON_OVERVIEW
@@ -3616,6 +3623,28 @@ char def;
return (*windowprocs.win_yn_function)(qbuf, resp, def);
}
/* for paranoid_confirm:quit,die,attack prompting */
boolean
paranoid_query(be_paranoid, prompt)
boolean be_paranoid;
const char *prompt;
{
char qbuf[QBUFSZ], ans[BUFSZ];
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 */
if (be_paranoid) {
Sprintf(qbuf, "%s (yes) [no]", prompt);
getlin(qbuf, ans);
(void) mungspaces(ans);
confirmed_ok = !strcmpi(ans, "yes");
} else
confirmed_ok = (yn(prompt) == 'y');
return confirmed_ok;
}
int
dosuspend_core(){
#ifdef SUSPEND