]> granicus.if.org Git - nethack/commitdiff
fix #H1996 - digging message for missing boulder
authornethack.rankin <nethack.rankin>
Sat, 22 Aug 2009 00:02:09 +0000 (00:02 +0000)
committernethack.rankin <nethack.rankin>
Sat, 22 Aug 2009 00:02:09 +0000 (00:02 +0000)
     From a bug report, it was possible to get
|You hit the  with all your might.  You stop digging.
if a boulder went away--in his case, it was picked up by a giant--while
you were occupied trying to break it with a pick-axe.  The code explicitly
used "" to fill in the message when dig_target had an unexpected value.

     This just avoids giving the message in a case like this.  Possibly
extra stop_occupation() calls should be done instead, but I didn't want
to try to figure out how many would be needed (monster picks up object,
monster zaps wand of striking, others?).

doc/fixes34.4
src/dig.c

index d99322ad40772eb7dccfa7c9225df5f2795686cd..83d7a4ee18ef26a3100b774f0f3ff2e1bda309c1 100644 (file)
@@ -382,6 +382,8 @@ trying to move down while levitating said "you are floating high above floor"
        even when being stuck in floor or lava blocked full levitation
 hero poly'd into mimic and hiding as an object via #monster didn't unhide
        when polymorphing into non-mimic
+message "You hit the  with all your might." could be issued if a boulder
+       went away while it was being dug/broken with a pick-axe
 
 
 Platform- and/or Interface-Specific Fixes
index 7cee5461781cd646a6cbec0d0cdb0593c5e44fa8..924ac321c3b40f2ecfaa8be62e717d004133a59b 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -1,5 +1,4 @@
 /* NetHack 3.5 dig.c   $Date$  $Revision$ */
-/*     SCCS Id: @(#)dig.c      3.5     2009/01/28      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -456,8 +455,10 @@ cleanup:
                              IS_DOOR(lev->typ) ? "door" : "wall", verb);
                        return(0);
                    }
-               } else if (!IS_ROCK(lev->typ) && dig_target == DIGTYP_ROCK)
+               } else if (dig_target == DIGTYP_UNDIGGABLE ||
+                       (dig_target == DIGTYP_ROCK && !IS_ROCK(lev->typ)))
                    return(0); /* statue or boulder got taken */
+
                if(!did_dig_msg) {
                    You("hit the %s with all your might.",
                        d_target[dig_target]);