]> granicus.if.org Git - nethack/commitdiff
Fix: levitating/flying monsters moving over liquid
authorMichael Meyer <me@entrez.cc>
Tue, 15 Mar 2022 22:28:46 +0000 (18:28 -0400)
committerPasi Kallinen <paxed@alt.org>
Wed, 16 Mar 2022 05:39:52 +0000 (07:39 +0200)
Commit c1a6dd4 was meant to prevent flying, levitating, and clinging
monsters from considering walls of water as acceptable movement
destinations, even outside of the Plane of Water.  However, it was
evaluating the monster's starting position instead of possible places to
move to, and the evaluation was 'backwards' (the equivalent of
IS_WATERWALL, instead of !IS_WATERWALL).

The result was that non-swimming monsters could only move onto any kind
of water or lava square if the position they were moving from was a
WATER square.  Change this so that instead of the starting position,
each potential destination spot's status as a wall of water is evaluated
in turn, and reverse the effect of the test so that it blocks walls of
water instead of allowing them.

src/mon.c

index d29303b90709d1ebb6758c476557ef5461aad008..7e20de0a77a39058204a80afce654ce5ff6ce1cd 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -1813,8 +1813,7 @@ mfndpos(
 
     nodiag = NODIAG(mdat - mons);
     wantpool = (mdat->mlet == S_EEL);
-    poolok = ((!Is_waterlevel(&u.uz) && IS_WATERWALL(nowtyp)
-               && !grounded(mdat))
+    poolok = ((!Is_waterlevel(&u.uz) && !grounded(mdat))
               || (is_swimmer(mdat) && !wantpool));
     /* note: floating eye is the only is_floater() so this could be
        simplified, but then adding another floater would be error prone */
@@ -1866,6 +1865,8 @@ mfndpos(
                 && !((flag & ALLOW_WALL) && may_passwall(nx, ny))
                 && !((IS_TREE(ntyp) ? treeok : rockok) && may_dig(nx, ny)))
                 continue;
+            if (IS_WATERWALL(ntyp) && !is_swimmer(mdat))
+                continue;
             /* KMH -- Added iron bars */
             if (ntyp == IRONBARS
                 && (!(flag & ALLOW_BARS)