]> granicus.if.org Git - nethack/commitdiff
rolling boulder hitting pit which holds monster
authornethack.rankin <nethack.rankin>
Sat, 17 Aug 2002 10:24:35 +0000 (10:24 +0000)
committernethack.rankin <nethack.rankin>
Sat, 17 Aug 2002 10:24:35 +0000 (10:24 +0000)
     From a bug report, a rolling boulder
trap could report that the boulder had fallen into the pit with you
and then let it keep rolling.  flooreffects() only returns true
when it uses up the object being manipulated but it doesn't use up
boulders that hit pits which hold monsters or the hero.  Its caller
needs to handle the cases where the boulder ends up sharing the pit
with a monster.

doc/fixes34.1
src/trap.c

index abbbf68ce9b4891d02e8ebaf715df2e8b49c8320..8a38da35081c8514abe683c232366c11d5ec3878 100644 (file)
@@ -207,6 +207,7 @@ zero entries in DUNGEON, MONSTERS, et al, of config file are now treated
        as preserving the default rather than being ignored
 enlightenment: don't misreport polymorphed lycanthrope as "in beast form"
 remove TIMED_DELAY from the features checked for version compatibility
+rolling boulder hitting monster stuck in pit should stop even when mon survives
 
 
 Platform- and/or Interface-Specific Fixes
index 5962ce5a26bb685e4b918ed1b14a1d9602ab7fba..250380d6394dd085f23b870d9d1962a277fa8515 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)trap.c     3.4     2002/07/14      */
+/*     SCCS Id: @(#)trap.c     3.4     2002/08/16      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1310,8 +1310,19 @@ int style;
                            seetrap(t);
                            used_up = TRUE;
                            break;
+                       case PIT:
+                       case SPIKED_PIT:
+                       case HOLE:
+                       case TRAPDOOR:
+                           /* the boulder won't be used up if there is a
+                              monster in the trap; stop rolling anyway */
+                           x2 = bhitpos.x,  y2 = bhitpos.y;  /* stops here */
+                           if (flooreffects(singleobj, x2, y2, "fall"))
+                               used_up = TRUE;
+                           dist = -1;  /* stop rolling immediately */
+                           break;
                        }
-                       if (used_up) break;
+                       if (used_up || dist == -1) break;
                    }
                    if (flooreffects(singleobj, bhitpos.x, bhitpos.y, "fall")) {
                        used_up = TRUE;