]> granicus.if.org Git - nethack/commitdiff
rolling boulder trap's boulder can be generated in lava
authornethack.allison <nethack.allison>
Wed, 1 Feb 2012 00:49:16 +0000 (00:49 +0000)
committernethack.allison <nethack.allison>
Wed, 1 Feb 2012 00:49:16 +0000 (00:49 +0000)
> On 01/30/2012 08:20 PM, <Someone> wrote:
> The boulder from a rolling boulder trap can be generated on a
> lava pool. mkroll_launch() in trap.c, line 1584 checks only for pools
> of water.

include/extern.h
src/dbridge.c
src/dig.c
src/do.c
src/eat.c
src/hack.c
src/polyself.c
src/trap.c

index 19f00a20df4458d72fff2fbfc9124a1354d26ab1..2f36c3d74399f901f11654397f228a5189bb6c93 100644 (file)
@@ -223,6 +223,7 @@ E boolean FDECL(paranoid_query, (BOOLEAN_P,const char *));
 
 E boolean FDECL(is_pool, (int,int));
 E boolean FDECL(is_lava, (int,int));
+E boolean FDECL(is_pool_or_lava, (int,int));
 E boolean FDECL(is_ice, (int,int));
 E int FDECL(is_drawbridge_wall, (int,int));
 E boolean FDECL(is_db_wall, (int,int));
index 6d34f215c9de1cec3c1849164e94a2bd3e3b8494..c900be04e39d308b6f404e8b241451fb52979c7a 100644 (file)
@@ -64,6 +64,16 @@ int x,y;
     return FALSE;
 }
 
+boolean
+is_pool_or_lava(x,y)
+int x,y;
+{
+    if (is_pool(x,y) || is_lava(x,y))
+       return TRUE;
+    else
+       return FALSE;
+}
+
 boolean
 is_ice(x,y)
 int x,y;
index 6fd4b34641ecafbe0e5e1d1c43256fc1b535b8b0..80f766ba98feecdd5adc55147a8d5ebb7b17250a 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -202,7 +202,7 @@ dig_check(madeby, verbose, x, y)
        } else if (madeby == BY_OBJECT &&
                    /* the block against existing traps is mainly to
                       prevent broken wands from turning holes into pits */
-                   (ttmp || is_pool(x,y) || is_lava(x,y))) {
+                   (ttmp || is_pool_or_lava(x,y))) {
            /* digging by player handles pools separately */
            return FALSE;
        }
@@ -747,7 +747,7 @@ coord *cc;
                                surface(dig_x,dig_y),
                                (dig_x != u.ux || dig_y != u.uy) ? "t" : "");
 
-       } else if (is_pool(dig_x, dig_y) || is_lava(dig_x, dig_y)) {
+       } else if (is_pool_or_lava(dig_x, dig_y)) {
                pline_The("%s sloshes furiously for a moment, then subsides.",
                        is_lava(dig_x, dig_y) ? "lava" : "water");
                wake_nearby();  /* splashing */
@@ -1117,7 +1117,7 @@ struct obj *obj;
                You("swing %s through thin air.", yobjnam(obj, (char *)0));
        } else if (!can_reach_floor(FALSE)) {
                cant_reach_floor(u.ux, u.uy, FALSE, FALSE);
-       } else if (is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) {
+       } else if (is_pool_or_lava(u.ux, u.uy)) {
                /* Monsters which swim also happen not to be able to dig */
                You("cannot stay under%s long enough.",
                                is_pool(u.ux, u.uy) ? "water" : " the lava");
index 4681760f8e02d84a0198907ecf890ad0ddd8fecd..532e3e7c595f25a2b4b38eaf13c1ab9d3477d465 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -53,7 +53,7 @@ boolean pushing;
 {
        if (!otmp || otmp->otyp != BOULDER)
            impossible("Not a boulder?");
-       else if (!Is_waterlevel(&u.uz) && (is_pool(rx,ry) || is_lava(rx,ry))) {
+       else if (!Is_waterlevel(&u.uz) && 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;
index 90efd56380923bea76dac49a525afa2aab647898..00173e5839ec2db29c88d048ef6f27eadf5ebf9a 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -2846,7 +2846,7 @@ floorfood(verb,corpsecheck)       /* get food from floor or pack */
 #ifdef STEED
                (feeding && u.usteed) || /* can't eat off floor while riding */
 #endif
-               ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) &&
+               (is_pool_or_lava(u.ux, u.uy) &&
                    (Wwalking || is_clinger(youmonst.data) ||
                        (Flying && !Breathless))))
            goto skipfloor;
index 30f26c969dd8c9d689db4ba97aafbb9e0a60c2b6..b656c4e5d1d8df64729d37c5aca8fa0c28c1b01d 100644 (file)
@@ -725,7 +725,7 @@ int mode;
        if ((t && t->tseen) ||
            (!Levitation && !Flying &&
             !is_clinger(youmonst.data) &&
-            (is_pool(x, y) || is_lava(x, y)) && levl[x][y].seenv))
+            is_pool_or_lava(x, y) && levl[x][y].seenv))
            return FALSE;
     }
 
@@ -1222,7 +1222,7 @@ domove()
                if (((trap = t_at(x, y)) && trap->tseen) ||
                    (Blind && !Levitation && !Flying &&
                     !is_clinger(youmonst.data) &&
-                    (is_pool(x, y) || is_lava(x, y)) && levl[x][y].seenv)) {
+                    is_pool_or_lava(x, y) && levl[x][y].seenv)) {
                        if(context.run >= 2) {
                                nomul(0);
                                context.move = 0;
@@ -1718,7 +1718,7 @@ boolean newspot;  /* true if called by spoteffects */
 
     /* check for entering water or lava */
     if (!u.ustuck && !Levitation && !Flying &&
-           (is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy))) {
+           is_pool_or_lava(u.ux, u.uy)) {
 #ifdef STEED
        if (u.usteed && (is_flyer(u.usteed->data) ||
                is_floater(u.usteed->data) || is_clinger(u.usteed->data))) {
@@ -2309,7 +2309,7 @@ bcorr:
            if(context.run == 1) goto bcorr;    /* if you must */
            if(x == u.ux+u.dx && y == u.uy+u.dy) goto stop;
            continue;
-       } else if (is_pool(x,y) || is_lava(x,y)) {
+       } else if (is_pool_or_lava(x,y)) {
            /* water and lava only stop you if directly in front, and stop
             * you even if you are running
             */
index b5ea0d5a054976b596ea483447c0d9d8fc1ae956..41f16548e77e93b7061debf75e366ebbd1150049 100644 (file)
@@ -199,8 +199,7 @@ const char *fmt, *arg;
        }
        check_strangling(TRUE);
 
-       if(!Levitation && !u.ustuck &&
-          (is_pool(u.ux,u.uy) || is_lava(u.ux,u.uy)))
+       if(!Levitation && !u.ustuck && is_pool_or_lava(u.ux,u.uy))
                spoteffects(TRUE);
 
        see_monsters();
@@ -746,7 +745,7 @@ int mntmp;
        }
        find_ac();
        if((!Levitation && !u.ustuck && !Flying &&
-           (is_pool(u.ux,u.uy) || is_lava(u.ux,u.uy))) ||
+           is_pool_or_lava(u.ux,u.uy)) ||
           (Underwater && !Swimming))
            spoteffects(TRUE);
        if (Passes_walls && u.utrap &&
index 9c4ab31f476f37a41e0f06de1ecb404a57514f2b..726298a5a8e10e8bee53f808b89ae687e03ff724 100644 (file)
@@ -1843,7 +1843,7 @@ long ocount;
                cc.x = x; cc.y = y;
                /* Prevent boulder from being placed on water */
                if (ttmp->ttyp == ROLLING_BOULDER_TRAP
-                               && is_pool(x+distance*dx,y+distance*dy))
+                               && is_pool_or_lava(x+distance*dx,y+distance*dy))
                        success = FALSE;
                else success = isclearpath(&cc, distance, dx, dy);
                if (ttmp->ttyp == ROLLING_BOULDER_TRAP) {