]> granicus.if.org Git - nethack/commitdiff
Fix polymorphing monster trying to dig undiggable wall
authorPasi Kallinen <paxed@alt.org>
Sat, 28 Mar 2020 13:43:00 +0000 (15:43 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 28 Mar 2020 13:43:10 +0000 (15:43 +0200)
Not sure if this can actually happen in a non-modified game, but
my fuzz testing stopped here, so deal with it.

If a polymorphing monster turns into an earth elemental or other
wall-phasing monster, it can wander into a non-diggable area, and
then turn into a tunneling monster.
This caused mdig_tunnel to issue an impossible.

src/monmove.c

index e88ab046445bcbce921d0624407b488843c46fb5..923e373ec140b564e7185655d9597fceded6233e 100644 (file)
@@ -1483,7 +1483,8 @@ register int after;
             }
 
             /* possibly dig */
-            if (can_tunnel && mdig_tunnel(mtmp))
+            if (can_tunnel && may_dig(mtmp->mx, mtmp->my)
+                && mdig_tunnel(mtmp))
                 return 2; /* mon died (position already updated) */
 
             /* set also in domove(), hack.c */