]> granicus.if.org Git - nethack/commitdiff
bargethrough/monster-vs-monster displacing
authorPatR <rankin@nethack.org>
Sun, 13 Dec 2020 23:51:23 +0000 (15:51 -0800)
committerPatR <rankin@nethack.org>
Sun, 13 Dec 2020 23:51:23 +0000 (15:51 -0800)
Fix the regression that monster movement flag unification
introduced for monsters able to swap places with adjacent
monsters.  It used to be restricted in order to prevent
Riders swapping places with other Riders so that they didn't
repeatedly exchange places when one was right behind the other
and the farther one moved first.  Then when displacer beasts
were added, that restriction was extended to prevent them
swapping places with Riders (but not the other way around.)
The flags change inadvertently let any displacer swap with any
other displacer.

doc/fixes37.0
src/mon.c

index 2ead283a6336ce58f21b5b0368151f27a624f66d..5dc2486464717c058eb947a18170b50a8981f9f5 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.390 $ $NHDT-Date: 1607895902 2020/12/13 21:45:02 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.391 $ $NHDT-Date: 1607901923 2020/12/13 23:25:23 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -432,6 +432,7 @@ dwarves could sometimes pass through walls without digging their way
 fix genetic engineers dropping Schroedinger's cat box
 the checks and handling for fountains, sinks, and drawbridges were being
        missed during liquid_flow
+monster movement flags unification allowed displacer beasts to displace Riders
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 06a00a4a38103c6c5aa8d200e154e48d993faf9d..ad126c6c56360932b6c3cbf2dafbf5200dc31839 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -1,4 +1,4 @@
-/* NetHack 3.7 mon.c   $NHDT-Date: 1607374002 2020/12/07 20:46:42 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.359 $ */
+/* NetHack 3.7 mon.c   $NHDT-Date: 1607901923 2020/12/13 23:25:23 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.360 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1586,8 +1586,10 @@ struct monst *mtmp;
         allowflags |= UNLOCKDOOR;
     if (passes_bars(mtmp->data))
         allowflags |= ALLOW_BARS;
+#if 0   /* can't do this here; leave it for mfndpos() */
     if (is_displacer(mtmp->data))
         allowflags |= ALLOW_MDISP;
+#endif
     if (is_minion(mtmp->data) || is_rider(mtmp->data))
         allowflags |= ALLOW_SANCT;
     /* unicorn may not be able to avoid hero on a noteleport level */
@@ -1712,7 +1714,7 @@ long flag;
                     || (m_at(x, ny) && m_at(nx, y) && worm_cross(x, y, nx, ny)
                         && !m_at(nx, ny) && (nx != u.ux || ny != u.uy))))
                 continue;
-            if ((is_pool(nx, ny) == wantpool || poolok)
+            if ((poolok || is_pool(nx, ny) == wantpool)
                 && (lavaok || !is_lava(nx, ny))) {
                 int dispx, dispy;
                 boolean monseeu = (mon->mcansee
@@ -1764,6 +1766,7 @@ long flag;
                                 info[cnt] |= ALLOW_TM;
                             }
                         } else {
+                            flag &= ~ALLOW_MDISP; /* depends upon defender */
                             mmflag = flag | mm_displacement(mon, mtmp2);
                             if (!(mmflag & ALLOW_MDISP))
                                 continue;