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:
53
src/cmd.c
53
src/cmd.c
@@ -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
|
||||
|
||||
@@ -1232,12 +1232,12 @@ dotakeoff()
|
||||
" Use 'R' command to remove accessories." : "");
|
||||
return 0;
|
||||
}
|
||||
if (armorpieces > 1)
|
||||
if (armorpieces > 1 || ParanoidRemove)
|
||||
otmp = getobj(clothes, "take off");
|
||||
if (otmp == 0) return(0);
|
||||
if (!otmp) return 0;
|
||||
if (!(otmp->owornmask & W_ARMOR)) {
|
||||
You("are not wearing that.");
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
/* note: the `uskin' case shouldn't be able to happen here; dragons
|
||||
can't wear any armor so will end up with `armorpieces == 0' above */
|
||||
@@ -1295,11 +1295,12 @@ doremring()
|
||||
" Use 'T' command to take off armor." : "");
|
||||
return(0);
|
||||
}
|
||||
if (Accessories != 1) otmp = getobj(accessories, "remove");
|
||||
if(!otmp) return(0);
|
||||
if(!(otmp->owornmask & (W_RING | W_AMUL | W_TOOL))) {
|
||||
if (Accessories > 1 || ParanoidRemove)
|
||||
otmp = getobj(accessories, "remove");
|
||||
if (!otmp) return 0;
|
||||
if (!(otmp->owornmask & (W_RING | W_AMUL | W_TOOL))) {
|
||||
You("are not wearing that.");
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */
|
||||
|
||||
@@ -298,7 +298,7 @@ int sig_unused;
|
||||
int
|
||||
done2()
|
||||
{
|
||||
if(yn("Really quit?") == 'n') {
|
||||
if (!paranoid_query(ParanoidQuit, "Really quit?")) {
|
||||
#ifndef NO_SIGNAL
|
||||
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
|
||||
#endif
|
||||
@@ -865,7 +865,7 @@ int how;
|
||||
wizard ||
|
||||
#endif
|
||||
discover) && (how <= GENOCIDED)) {
|
||||
if(yn("Die?") == 'y') goto die;
|
||||
if (paranoid_query(ParanoidDie, "Die?")) goto die;
|
||||
pline("OK, so you don't %s.",
|
||||
(how == CHOKING) ? "choke" : "die");
|
||||
savelife(how);
|
||||
|
||||
@@ -1648,9 +1648,8 @@ int
|
||||
dopray()
|
||||
{
|
||||
/* Confirm accidental slips of Alt-P */
|
||||
if (flags.prayconfirm)
|
||||
if (yn("Are you sure you want to pray?") == 'n')
|
||||
return 0;
|
||||
if (ParanoidPray && yn("Are you sure you want to pray?") != 'y')
|
||||
return 0;
|
||||
|
||||
u.uconduct.gnostic++;
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
|
||||
}
|
||||
if (canspotmon(mtmp)) {
|
||||
Sprintf(qbuf, "Really attack %s?", mon_nam(mtmp));
|
||||
if (yn(qbuf) != 'y') {
|
||||
if (!paranoid_query(ParanoidHit, qbuf)) {
|
||||
context.move = 0;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user