]> granicus.if.org Git - nethack/commitdiff
Check monster relocation degenerate cases more strictly
authorPasi Kallinen <paxed@alt.org>
Sat, 17 Nov 2018 17:48:48 +0000 (19:48 +0200)
committerPasi Kallinen <paxed@alt.org>
Mon, 19 Nov 2018 19:16:50 +0000 (21:16 +0200)
Just in case we're trying to put the monster on the same location
where it already thinks it is... but actually isn't.

src/mon.c
src/teleport.c

index 7340e1ad6a40a657e16bdb849bd54f6cb52e8feb..232992d324845ea5cb0e976e0327daa40cdb3173 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -2586,7 +2586,7 @@ boolean move_other; /* make sure mtmp gets to x, y! so move m_at(x, y) */
     xchar newx, newy;
     coord mm;
 
-    if (mtmp->mx == x && mtmp->my == y)
+    if (mtmp->mx == x && mtmp->my == y && m_at(x,y) == mtmp)
         return TRUE;
 
     if (move_other && (othermon = m_at(x, y)) != 0) {
index 9a6ff8f19ac052c660632976b51832e46bf0f26d..a7901e3d90d905a29b2ad08875a2667286758b63 100644 (file)
@@ -1005,8 +1005,8 @@ register int x, y;
     register int oldx = mtmp->mx, oldy = mtmp->my;
     boolean resident_shk = mtmp->isshk && inhishop(mtmp);
 
-    if (x == mtmp->mx && y == mtmp->my) /* that was easy */
-        return;
+    if (x == mtmp->mx && y == mtmp->my && m_at(x,y) == mtmp)
+        return; /* that was easy */
 
     if (oldx) { /* "pick up" monster */
         if (mtmp->wormno) {