[comp.sources.bugs] another nethack bug

ralf@b.gp.cs.cmu.edu (Ralf Brown) (08/06/87)

I was having trouble getting my dog to follow me down to level 2--even when it
was on a leash (as I was lucky enough to find one once).  When I got back up
from level 2, the screen was displayed with the dog right where it was when I
went down.  However, when I moved to the square, there was no warning, and 
when I moved off, the dog had disappeared.

The real clue, however, was when I walked right through an enormous rock, and
it disappeared just like the dog.

I turns out that if DGK is #defined (one of the sets of enhancements), the
monsters, gold, and objects on the current level get wiped out before they
get saved!

The fix is this change (in savelev0 of lev.c):

        fgold = 0;
        ftrap = 0;
        fmon = 0;
        fobj = 0;
----
#ifdef DGK
        if (!count_only)
#endif
                {
                fgold = 0;
                ftrap = 0;
                fmon = 0;
                fobj = 0;
                }
----

-- 
-=-=-=-=-=-=-=-= {harvard,seismo,ucbvax}!b.gp.cs.cmu.edu!ralf =-=-=-=-=-=-=-=-
ARPAnet: RALF@B.GP.CS.CMU.EDU            BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA
AT&Tnet: (412) 268-3053 (school)         FIDOnet: Ralf Brown at 129/31
	        DISCLAIMER?  Who ever said I claimed anything? 
"I do not fear computers.  I fear the lack of them..." -- Isaac Asimov

ssnyder@tybalt.caltech.edu (Scott S. Snyder) (08/21/87)

  If the graphics symbols for VWALL or HWALL are set to characters with the
high bit set (as might happen on a mess-dos machine), zapping with a ray-type
wand or spell causes a slew of "At gets null" errors. The problem is that
these characters are being passed to a routine (Tmp_at) which compares them
with zero (values <=0 signal special functions). 
  A fix is to change Tmp_at (and tmp_at while we're at it) to accept ints
instead of chars as arguments and to convince buzz() to pass unsigned chars
to Tmp_at:

  In prisym.c, change the declaration of tmp_at on line 41 from

    tmp_at(x,y) schar x,y; {

  to

    tmp_at(x,y) int x,y; {

  and change the declaration of Tmp_at on line 69 from

    Tmp_at(x,y) schar x,y; {

  to

    Tmp_at(x,y) int x,y; {


  and in zap.c, change the declaration of dirlet on lines 675 and 676 from

    char
    dirlet(dx,dy) register dx,dy; {

  to

    uchar
    dirlet(dx,dy) register dx,dy; {

xsimon@its63b.UUCP (09/01/87)

If you have no weapon wielded and you #pray to the gods, if they decide
to bless your weapon, they will try to uncurse your rings instead. If you
are not wearing any rings either, nethack will core-dump (except on a vax).
Also, due to a typo, it always uncurses your *left* ring, even when it says
it's doing the right one (in the rare cases when in *doesn't* core-dump!).

Context-diff follows:
--------------------------------------------------
*** /tmp/pr.c	Tue Sep  1 15:21:29 1987
--- pray.c	Tue Sep  1 15:21:20 1987
***************
*** 85,91
  			break;
  	    case 1:
  			if(!uwep) {
! 			    if(uleft->cursed) {
  				pline("your left hand glows amber.");
  				uleft->cursed = 0;
  			    } else if(uright->cursed) {

--- 85,91 -----
  			break;
  	    case 1:
  			if(!uwep) {
! 			    if(uleft && uleft->cursed) {
  				pline("your left hand glows amber.");
  				uleft->cursed = 0;
  			    } else if(uright && uright->cursed) {
***************
*** 88,94
  			    if(uleft->cursed) {
  				pline("your left hand glows amber.");
  				uleft->cursed = 0;
! 			    } else if(uright->cursed) {
  				pline("your right hand glows amber.");
  				uleft->cursed = 0;
  			    } else    pline("but nothing seems to happen.");

--- 88,94 -----
  			    if(uleft && uleft->cursed) {
  				pline("your left hand glows amber.");
  				uleft->cursed = 0;
! 			    } else if(uright && uright->cursed) {
  				pline("your right hand glows amber.");
  				uright->cursed = 0;
  			    } else    pline("but nothing seems to happen.");
***************
*** 90,96
  				uleft->cursed = 0;
  			    } else if(uright->cursed) {
  				pline("your right hand glows amber.");
! 				uleft->cursed = 0;
  			    } else    pline("but nothing seems to happen.");
  			    break;
  			}

--- 90,96 -----
  				uleft->cursed = 0;
  			    } else if(uright && uright->cursed) {
  				pline("your right hand glows amber.");
! 				uright->cursed = 0;
  			    } else    pline("but nothing seems to happen.");
  			    break;
  			}
-- 
----------------------------------
| Simon Brown                    | UUCP:  seismo!mcvax!ukc!its63b!simon
| Department of Computer Science | JANET: simon@uk.ac.ed.its63b
| University of Edinburgh,       | ARPA:  simon%its63b.ed.ac.uk@cs.ucl.ac.uk
| Scotland, UK.                  |
----------------------------------     "Life's like that, you know"