]> granicus.if.org Git - nethack/commitdiff
Fix monster trapped in nonexistent trap
authorPasi Kallinen <paxed@alt.org>
Sat, 5 Mar 2022 09:26:39 +0000 (11:26 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 5 Mar 2022 09:29:06 +0000 (11:29 +0200)
A monster trapped in a bear trap on ice, exploding fiery monster
turned the ice into water turning the trap into object, the trapped
monster claimed to be still trapped in the nonexistent trap.

src/trap.c

index ebc3e78e0baa00115c31dd0658fe905e06567efd..deeab493fe376a6c105e5ad73febb6c9bb078f39 100644 (file)
@@ -4500,6 +4500,7 @@ cnv_trap_obj(
     boolean bury_it)
 {
     struct obj *otmp = mksobj(otyp, TRUE, FALSE);
+    struct monst *mtmp;
 
     otmp->quan = cnt;
     otmp->owt = weight(otmp);
@@ -4519,6 +4520,8 @@ cnv_trap_obj(
     newsym(ttmp->tx, ttmp->ty);
     if (u.utrap && u_at(ttmp->tx, ttmp->ty))
         reset_utrap(TRUE);
+    if (((mtmp = m_at(ttmp->tx, ttmp->ty)) != 0) && mtmp->mtrapped)
+        mtmp->mtrapped = 0;
     deltrap(ttmp);
 }