This is a slightly modified version of Scott Bigham's opt-paranoid patch, version 3. The differences are: - Re-worked for use with patchable Nethack. - I moved the flag to instance flags to retain bones compatibility with the standard version. Bones/save compatibility: This patch doesn't affect saved games or bones files. This patch is available at http://www.argon.org/~roderick/nethack/. Roderick Schertler diff -r -X /home/roderick/.diff-exclude -uN base.patchable/dat/opthelp work.opt-paranoid/dat/opthelp --- base.patchable/dat/opthelp 2003-02-23 09:43:16.000000000 -0500 +++ work.opt-paranoid/dat/opthelp 2003-03-23 10:06:28.000000000 -0500 @@ -82,6 +82,9 @@ start of the game. Doing so enhances performance of the tile graphics, but uses more memory. [TRUE] +Boolean option if PARANOID was set at compile time: +paranoid require "yes" instead of just 'y' in some cases [FALSE] + Any Boolean option can be negated by prefixing it with a '!' or 'no'. diff -r -X /home/roderick/.diff-exclude -uN base.patchable/doc/Guidebook.mn work.opt-paranoid/doc/Guidebook.mn --- base.patchable/doc/Guidebook.mn 2003-02-23 09:43:18.000000000 -0500 +++ work.opt-paranoid/doc/Guidebook.mn 2003-03-23 10:06:28.000000000 -0500 @@ -1958,6 +1958,10 @@ The value of this option should be a string containing the symbols for the various object types. Any omitted types are filled in at the end from the previous order. +.lp paranoid +If true, certain yes/no questions will require a full ``yes'' instead of +a simple `y' to register an affirmative response. Only available if the +PARANOID option was enabled at compile time. .lp perm_invent If true, always display your current inventory in a window. This only makes sense for windowing system interfaces that implement this feature. diff -r -X /home/roderick/.diff-exclude -uN base.patchable/doc/Guidebook.tex work.opt-paranoid/doc/Guidebook.tex --- base.patchable/doc/Guidebook.tex 2003-02-23 09:43:18.000000000 -0500 +++ work.opt-paranoid/doc/Guidebook.tex 2003-03-23 10:06:28.000000000 -0500 @@ -2401,6 +2401,10 @@ ``\verb&")[%?+!=/(*`0_&''). The value of this option should be a string containing the symbols for the various object types. Any omitted types are filled in at the end from the previous order. +\item[\ib{paranoid}] +If true, certain yes/no questions will require a full ``yes'' instead of +a simple `y' to register an affirmative response. Only available if the +{\tt PARANOID} option was enabled at compile time. %.lp \item[\ib{perm\_invent}] If true, always display your current inventory in a window. This only diff -r -X /home/roderick/.diff-exclude -uN base.patchable/include/config.h work.opt-paranoid/include/config.h --- base.patchable/include/config.h 2003-03-20 16:41:57.000000000 -0500 +++ work.opt-paranoid/include/config.h 2003-03-23 10:06:49.000000000 -0500 @@ -364,6 +364,12 @@ /* * options patch point; see $top/README.patchable */ + +#define PARANOID /* optionally require "yes" not 'y' in some cases */ + +/* + * options patch point; see $top/README.patchable + */ /* * options patch point; see $top/README.patchable */ diff -r -X /home/roderick/.diff-exclude -uN base.patchable/include/extern.h work.opt-paranoid/include/extern.h --- base.patchable/include/extern.h 2003-02-23 09:43:20.000000000 -0500 +++ work.opt-paranoid/include/extern.h 2003-03-23 10:06:28.000000000 -0500 @@ -170,6 +170,9 @@ E void FDECL(dtoxy, (coord *,int)); E int FDECL(movecmd, (CHAR_P)); E int FDECL(getdir, (const char *)); +#ifdef PARANOID +E int FDECL(paranoid_yesno, (const char *)); +#endif /* PARANOID */ E void NDECL(confdir); E int FDECL(isok, (int,int)); E int FDECL(get_adjacent_loc, (const char *, const char *, XCHAR_P, XCHAR_P, coord *)); diff -r -X /home/roderick/.diff-exclude -uN base.patchable/include/flag.h work.opt-paranoid/include/flag.h --- base.patchable/include/flag.h 2003-03-20 16:41:57.000000000 -0500 +++ work.opt-paranoid/include/flag.h 2003-03-23 10:06:28.000000000 -0500 @@ -279,6 +279,12 @@ /* * compat instance_flags patch point; see $top/README.patchable */ +#ifdef PARANOID + boolean paranoid; /* Require "yes" instead of 'y in some cases */ +#endif /* PARANOID */ + /* + * compat instance_flags patch point; see $top/README.patchable + */ /* * compat instance_flags patch point; see $top/README.patchable */ diff -r -X /home/roderick/.diff-exclude -uN base.patchable/src/apply.c work.opt-paranoid/src/apply.c --- base.patchable/src/apply.c 2003-02-23 09:43:24.000000000 -0500 +++ work.opt-paranoid/src/apply.c 2003-03-23 10:06:28.000000000 -0500 @@ -2546,7 +2546,12 @@ Strcpy(the_wand, yname(obj)); Sprintf(confirm, "Are you really sure you want to break %s?", the_wand); +#ifndef PARANOID if (yn(confirm) == 'n' ) return 0; +#else + if (iflags.paranoid ? !paranoid_yesno(confirm) : (yn(confirm) == 'n')) + return 0; +#endif /* PARANOID */ if (nohands(youmonst.data)) { You_cant("break %s without hands!", the_wand); diff -r -X /home/roderick/.diff-exclude -uN base.patchable/src/cmd.c work.opt-paranoid/src/cmd.c --- base.patchable/src/cmd.c 2003-02-23 09:43:25.000000000 -0500 +++ work.opt-paranoid/src/cmd.c 2003-03-23 10:06:28.000000000 -0500 @@ -475,9 +475,16 @@ STATIC_PTR int enter_explore_mode() { + static const char *confirm = "Do you want to enter explore mode?"; + 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') { +#ifndef PARANOID + if (yn(confirm) == 'y') +#else + if (iflags.paranoid ? paranoid_yesno(confirm) : yn(confirm) == 'y') +#endif + { clear_nhwindow(WIN_MESSAGE); You("are now in non-scoring explore mode."); discover = TRUE; @@ -2117,6 +2124,26 @@ return TRUE; } +#ifdef PARANOID +int +paranoid_yesno(s) +const char *s; +{ + char buf[BUFSZ]; + char query[QBUFSZ]; + + /* Make sure we have enough room for the "yes/no" before adding it. */ + if (strlen(s) < QBUFSZ - 10) { + strcpy(query, s); + strcat(query, " [yes/no]"); + s = query; + } + getlin(s, buf); + (void)lcase(buf); + return !strcmp(buf, "yes"); +} +#endif /* PARANOID */ + #endif /* OVL1 */ #ifdef OVLB diff -r -X /home/roderick/.diff-exclude -uN base.patchable/src/end.c work.opt-paranoid/src/end.c --- base.patchable/src/end.c 2003-02-23 09:43:26.000000000 -0500 +++ work.opt-paranoid/src/end.c 2003-03-23 10:06:28.000000000 -0500 @@ -112,7 +112,13 @@ int done2() { - if(yn("Really quit?") == 'n') { +#ifndef PARANOID + if(yn("Really quit?") == 'n') +#else + if(iflags.paranoid ? + !paranoid_yesno("Really quit?") : (yn("Really quit?") == 'n')) +#endif /* PARANOID */ + { #ifndef NO_SIGNAL (void) signal(SIGINT, (SIG_RET_TYPE) done1); #endif diff -r -X /home/roderick/.diff-exclude -uN base.patchable/src/options.c work.opt-paranoid/src/options.c --- base.patchable/src/options.c 2003-03-18 20:58:07.000000000 -0500 +++ work.opt-paranoid/src/options.c 2003-03-23 10:06:28.000000000 -0500 @@ -147,6 +147,9 @@ #else {"page_wait", (boolean *)0, FALSE, SET_IN_FILE}, #endif +#ifdef PARANOID + {"paranoid", &iflags.paranoid, FALSE, SET_IN_GAME}, +#endif /* PARANOID */ {"perm_invent", &flags.perm_invent, FALSE, SET_IN_GAME}, {"popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME}, /*WC*/ {"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME}, diff -r -X /home/roderick/.diff-exclude -uN base.patchable/src/polyself.c work.opt-paranoid/src/polyself.c --- base.patchable/src/polyself.c 2003-02-23 09:43:29.000000000 -0500 +++ work.opt-paranoid/src/polyself.c 2003-03-23 10:06:28.000000000 -0500 @@ -957,7 +957,13 @@ Sprintf(qbuf, "Really %s %s?", (adtyp == AD_CONF) ? "confuse" : "attack", mon_nam(mtmp)); +#ifndef PARANOID if (yn(qbuf) != 'y') continue; +#else + if (iflags.paranoid ? + !paranoid_yesno(qbuf) : (yn(qbuf) != 'y')) + continue; +#endif /* PARANOID */ setmangry(mtmp); } if (!mtmp->mcanmove || mtmp->mstun || mtmp->msleeping || diff -r -X /home/roderick/.diff-exclude -uN base.patchable/src/uhitm.c work.opt-paranoid/src/uhitm.c --- base.patchable/src/uhitm.c 2003-02-23 09:43:31.000000000 -0500 +++ work.opt-paranoid/src/uhitm.c 2003-03-23 10:06:28.000000000 -0500 @@ -200,7 +200,13 @@ } if (canspotmon(mtmp)) { Sprintf(qbuf, "Really attack %s?", mon_nam(mtmp)); - if (yn(qbuf) != 'y') { +#ifndef PARANOID + if (yn(qbuf) != 'y') +#else + if (iflags.paranoid ? + !paranoid_yesno(qbuf) : (yn(qbuf) != 'y')) +#endif /* PARANOID */ + { flags.move = 0; return(TRUE); } diff -r -X /home/roderick/.diff-exclude -uN base.patchable/util/makedefs.c work.opt-paranoid/util/makedefs.c --- base.patchable/util/makedefs.c 2003-03-20 16:41:56.000000000 -0500 +++ work.opt-paranoid/util/makedefs.c 2003-03-23 10:06:28.000000000 -0500 @@ -752,6 +752,12 @@ /* * patch list patch point; see $top/README.patchable */ +#ifdef PARANOID + "patch: opt-paranoid v3-patchable", +#endif + /* + * patch list patch point; see $top/README.patchable + */ /* * patch list patch point; see $top/README.patchable */