From: snelling@bnr.ca (Peter Snelling)
Subject: Warning String Modification (was:Floating Eye Confirm)
Reply-To: snelling@bnr.ca (Peter Snelling)
Organization: Bell-Northern Research Ltd.
Date: Thu, 1 Oct 92 23:12:39 GMT

Well, I suggested it as a modification for 3.1, but given the amount
of oppostion some people had to it, I doubt it will ever become 
part of the official release.

Nevertheless, I want it, so I wrote it.

For those of you who haven't been following this thread, the point of
this modification is to allow the user to avoid some stupid deaths --
things like stepping into moats, attacking floating eyes, walking into
already identified traps.  It does this by allowing the user to set
a string of symbols (eg:e^}...) and checking with the user before 
allowing the character to move onto one of those symbols.

For those of you who have never pressed down when you meant left
(or else those of you who get pleasure from dying stupidly in nethack)
please ignore the following waste of bandwidth. :)

For the rest of you, here is my change.  It (intentionally) doesn't
work when you're confused, stunned, or hallucinating.  It doesn't work
on mimics, anything hidden, or when you're blind and not telepathic.
All that would (IMHO) be an unfair advantage.  All this does is 
check before moving onto a symbol currently on the screen which 
you specified you don't normally want to move onto/attack.

To set the string select O(ptions) and type warning_string:ej^}
or just warn:lne or set warning_string in your environment
variable/config file.  (Looks like setting the options may work 
differently on Macs -- I haven't tested this with anything but 
UNIX).

diff hack.c original/hack.c
448,485d447
< #ifdef SNELLING_MODS /* Warning String */
<       if (!Confusion && !Hallucination && !Stunned && !u.uswallow) {
<               if ((!mtmp) || (Blind && !Telepat) ||
<               (mtmp->mhide && mtmp->mundetected) ||
<               (mtmp->mimic && !Protection_from_shape_changers) ) {
<                       uchar tmpsymbol;
<                       tmpsymbol = levl[x][y].scrsym;
<                       if (!tmpsymbol || (!levl[x][y].seen))
<                               tmpsymbol = ' ';
<                       if (index(warning_string,(char)tmpsymbol)) {
<                               pline("Warning -- are you sure? ");
<                               if (yn() == 'n') {
<                                       flags.move = 0;
<                                       nomul(0);
<                                       return;
<                               }
<                       }
<                 }
<               else if ( (!(mtmp->mtame && flags.safe_dog))&&
<               (!((mtmp->mpeaceful||mtmp->mtame) && flags.confirm)) &&
<               (Blind ? Telepat : (!mtmp->minvis || See_invisible)) ){
<                       uchar tmpsymbol;
<                       tmpsymbol = levl[x][y].scrsym;
<                       if (!tmpsymbol || (!levl[x][y].seen))
<                               tmpsymbol = ' ';
<                       if (index(warning_string,(char)tmpsymbol)) {
<                               pline("Warning -- really attack %s? ",
<                                       mon_nam(mtmp));
<                               if (yn() == 'n') {
<                                       flags.move = 0;
<                                       nomul(0);
<                                       return;
<                               }
<                       }
<               }
<       }
< #endif /* SNELLING_MODS Warning String*/




diff decl.c original/decl.c
51,54d50
< #ifdef SNELLING_MODS /* Warning String */
< char NEARDATA warning_string[63] = DUMMY;
< #endif /* SNELLING_MODS Warning String*/
<




[hope the following line numbers are right -- I've made some
other changes to this file which I've deleted from the diff]
diff options.c original/options.c
611,618d600
< #ifdef SNELLING_MODS /* Warning String */
<       if (!strncmp(opts, "warn", 4)) {
<               op = index(opts, ':');
<               if (!op++) goto bad;
<                 nmcpy(warning_string, op, 62);
<                 return;
<       }
< #endif /* SNELLING_MODS Warning String */
1012,1014d993
< #ifdef SNELLING_MODS /* Warning String */
<             Sprintf(eos(buf), "warning_string:%s,", warning_string);
< #endif /* SNELLING_MODS Warning String */




diff decl.h original/decl.h
87,89d86
< #ifdef SNELLING_MODS /* Warning String */
< E char NEARDATA warning_string[];
< #endif /* SNELLING_MODS Warning String*/




diff config.h original/config.h
256d255
< #define SNELLING_MODS /* Various mods by Peter Snelling */


-- 
Peter Snelling
Newsgroups: rec.games.hack