]> granicus.if.org Git - nethack/commitdiff
Fix monster triggering land mine accessing deleted trap
authorPasi Kallinen <paxed@alt.org>
Sun, 13 Oct 2019 17:52:34 +0000 (20:52 +0300)
committerPasi Kallinen <paxed@alt.org>
Sun, 13 Oct 2019 17:52:38 +0000 (20:52 +0300)
mintrap -> thitm -> mondied -> relobj -> mdrop_obj ->
flooreffects -> deltrap

after calling thitm, the mintrap code was trying to access the trap.

doc/fixes36.3
src/trap.c

index 94af4399698ff3844738aba3264a5758429e4607..ee3964155573d56e493721d463a73351d7a9bcb5 100644 (file)
@@ -184,6 +184,7 @@ fix temple priests or shopkeepers moving over other monsters
 fix hero still hiding under a statue shattered by a land mine
 fix helping a monster out of a pit addressing a deleted trap
 fix launched rolling boulder code accessing deleted trap
+fix monster stepping on a land mine code accessing deleted trap
 
 
 Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
index 6b9884ea60edac9ec4a92cc4514316f70459a0e7..cb025e514e2888dd322576087889b9c02b15f22b 100644 (file)
@@ -2167,6 +2167,7 @@ register struct monst *mtmp;
             inescapable = force_mintrap || ((tt == HOLE || tt == PIT)
                                             && Sokoban && !trap->madeby_u);
         const char *fallverb;
+        xchar tx = trap->tx, ty = trap->ty;
 
         /* true when called from dotrap, inescapable is not an option */
         if (mtmp == u.usteed)
@@ -2649,7 +2650,7 @@ register struct monst *mtmp;
                     trapkilled = TRUE;
             }
             /* a boulder may fill the new pit, crushing monster */
-            fill_pit(trap->tx, trap->ty);
+            fill_pit(tx, ty); /* thitm may have already destroyed the trap */
             if (DEADMONSTER(mtmp))
                 trapkilled = TRUE;
             if (unconscious()) {