[comp.sources.bugs] Graphics and poison bugs in Nethack

creps@silver.UUCP (09/25/87)

   I have fixed a couple of bugs in Nethack 1.4. Here they are:

Bug:
       When using the GRAPHICS option from the HACK.CNF file in the PC version
of Nethack, most of the graphics characters defined are not read by the init
routine. This caused an "at gets null" error when moving off an up stairway,
and many symbols to be incorrectly defined.

Fix:
       The code in msdos.c had not been rewritten to handle more than the
original nine GRAPHICS characters. I applied the necessary changes to let
the rest of the characters be defined.

Diffs:
*** msdos.old  Thu Sep 24 03:13:25 1987
--- msdos.c    Thu Sep 24 03:13:24 1987
***************
*** 507,515
                       struct symbols s;
  /*                   struct symbols s = defsyms;*/
  
!                      if (sscanf(bufp, "%u%u%u%u%u%u%u%u%u", &s.vwall,
!                                  &s.hwall, &s.tlcorn, &s.trcorn, &s.blcorn,
!                                  &s.brcorn, &s.door, &s.room, &s.corr) == 9)
  /*                           symbol = s;*/
                         showsyms = s;
                       else {

--- 507,518 -----
                       struct symbols s;
  /*                   struct symbols s = defsyms;*/
  
!                      if (sscanf(bufp, "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u",
!                                  &s.stone, &s.vwall, &s.hwall, &s.tlcorn,
!                                  &s.trcorn, &s.blcorn, &s.brcorn, &s.door,
!                                  &s.room, &s.corr, &s.upstair, &s.dnstair,
!                                  &s.trap, &s.pool, &s.fountain, &s.throne,
!                                  &s.web) == 17)
  /*                           symbol = s;*/
                         showsyms = s;
                       else {
***************
*** 513,519
  /*                           symbol = s;*/
                         showsyms = s;
                       else {
!                              msmsg("GRAPHICS did not contain 9 values\n");
                               getreturn("to continue");
                       }
               } else {

--- 516,522 -----
  /*                           symbol = s;*/
                         showsyms = s;
                       else {
!                              msmsg("GRAPHICS did not contain 17 values\n");
                               getreturn("to continue");
                       }
               } else {



Bug:
	After you get INTRINSIC poison resistance, i.e. by eating a _______,
anything poisonous you eat should not lower your strength. However, quaffing
a potion of sickness still lowers your strength, even though it says it was
biologically contaminated orange juice. Looks to me like it's not a feature,
it's a bug! The same problem also occurs in PC Hack.

Fix:
	The section of code that handles quaffing a potion of sickness is
missing an else clause, so that it lowers your strength every time, instead of
only when intrinsic poison resistance is false. I inserted this else into the
source code.

Diffs:
*** potion.old	Thu Sep 24 03:21:08 1987
--- potion.c	Thu Sep 24 03:22:13 1987
***************
*** 198,203
  		pline("Yech! This stuff tastes like poison.");
  		if(Poison_resistance)
      pline("(But in fact it was biologically contaminated orange juice.)");
  #ifdef KAA
  		if (pl_character[0] == 'H')
  			pline("Fortunately you have been immunized!");

--- 198,204 -----
  		pline("Yech! This stuff tastes like poison.");
  		if(Poison_resistance)
      pline("(But in fact it was biologically contaminated orange juice.)");
+     		else	{
  #ifdef KAA
  		if (pl_character[0] == 'H')
  			pline("Fortunately you have been immunized!");
***************
*** 211,216
  		if(Hallucination) {
  			pline("You are shocked back to your senses!");
  			Hallucination=1;
  		}
  		break;
  	case POT_CONFUSION:

--- 212,218 -----
  		if(Hallucination) {
  			pline("You are shocked back to your senses!");
  			Hallucination=1;
+ 		}
  		}
  		break;
  	case POT_CONFUSION:







   Good luck, and I hope this gets into the 2.0 version in time.

-	-	-	-	-	-	-	-	-
Steve Creps on the VAX 8650 running Ultrix 2.0-1 at Indiana University.
	creps@silver.bacs.indiana.edu
Count De Monet: "Oh Bearnaise, do we have any more of those delicious raisons?"
Bearnaise: "You ate yours! These are mine!"