]> granicus.if.org Git - nethack/commitdiff
boulder sanity check
authorPatR <rankin@nethack.org>
Sat, 2 Jul 2022 18:54:31 +0000 (11:54 -0700)
committerPatR <rankin@nethack.org>
Sat, 2 Jul 2022 18:54:31 +0000 (11:54 -0700)
From entrez, pushing a boulder into the water on Plane of Water
resulted in a sanity check warning about a boulder at water location
(every turn until bubble movement eventually pushed it back out of
the water).  Make boulders in that situation always fail to plug the
water and vanish rather not attempt to plug and remain intact.

This also changes the chance to plugging water from 90% to 50% when
dealing with a wall of water somewhere other than Plane of Water.

doc/fixes3-7-0.txt
src/do.c

index 630ae1e6b315963e48b728f180db4b97705c9df9..7164fea3516b850d7b8cafa45e1b3a50699f60fe 100644 (file)
@@ -1282,6 +1282,7 @@ save files created with SCORE_ON_BOTL disabled were erroneously being rejected
        if the program was rebuilt with it enabled and vice versa
 avoid "It suddenly appears!" if a monster with the STRAT_APPEARMSG attribute
        is seen to teleport away then not seen at its destination
+avoid boulder-on/in-water sanity_check warnings on the Plane of Water
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 172a4d3cd3ced16d04f407a33049e1970a40821e..7c6018f0014ee143193446b990275df1341bb42e 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -43,18 +43,23 @@ dodrop(void)
  * it's gone for good...  If the destination is not a pool, returns FALSE.
  */
 boolean
-boulder_hits_pool(struct obj *otmp, coordxy rx, coordxy ry, boolean pushing)
+boulder_hits_pool(
+    struct obj *otmp,
+    coordxy rx, coordxy ry,
+    boolean pushing)
 {
     if (!otmp || otmp->otyp != BOULDER) {
         impossible("Not a boulder?");
-    } else if (!Is_waterlevel(&u.uz) && is_pool_or_lava(rx, ry)) {
+    } else if (is_pool_or_lava(rx, ry)) {
         boolean lava = is_lava(rx, ry), fills_up;
         const char *what = waterbody_name(rx, ry);
         schar ltyp = levl[rx][ry].typ;
         int chance = rn2(10); /* water: 90%; lava: 10% */
         struct monst *mtmp;
 
-        fills_up = lava ? chance == 0 : chance != 0;
+        fills_up = Is_waterlevel(&u.uz) ? FALSE
+                   : (ltyp == WATER) ? (chance < 5) /* wall of water */
+                     : lava ? (chance == 0) : (chance != 0);
 
         if (fills_up) {
             struct trap *ttmp = t_at(rx, ry);
@@ -62,9 +67,9 @@ boulder_hits_pool(struct obj *otmp, coordxy rx, coordxy ry, boolean pushing)
             if (ltyp == DRAWBRIDGE_UP) {
                 levl[rx][ry].drawbridgemask &= ~DB_UNDER; /* clear lava */
                 levl[rx][ry].drawbridgemask |= DB_FLOOR;
-            } else
+            } else {
                 levl[rx][ry].typ = ROOM, levl[rx][ry].flags = 0;
-
+            }
             /* 3.7: normally DEADMONSTER() is used when traversing the fmon
                list--dead monsters usually aren't still at specific map
                locations; however, if ice melts causing a giant to drown,
@@ -100,8 +105,9 @@ boulder_hits_pool(struct obj *otmp, coordxy rx, coordxy ry, boolean pushing)
                     There("is a large splash as %s %s the %s.",
                           the(xname(otmp)), fills_up ? "fills" : "falls into",
                           what);
-                } else if (!Deaf)
+                } else if (!Deaf) {
                     You_hear("a%s splash.", lava ? " sizzling" : "");
+                }
                 wake_nearto(rx, ry, 40);
             }
 
@@ -112,6 +118,7 @@ boulder_hits_pool(struct obj *otmp, coordxy rx, coordxy ry, boolean pushing)
                 You("find yourself on dry land again!");
             } else if (lava && next2u(rx, ry)) {
                 int dmg;
+
                 You("are hit by molten %s%c",
                     hliquid("lava"), Fire_resistance ? '.' : '!');
                 burn_away_slime();