From: nethack.allison Date: Wed, 1 Feb 2012 00:49:16 +0000 (+0000) Subject: rolling boulder trap's boulder can be generated in lava X-Git-Tag: MOVE2GIT~63 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e701a681755fbea5b4e898f06c4c9d2b169f744b;p=nethack rolling boulder trap's boulder can be generated in lava > On 01/30/2012 08:20 PM, 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. --- diff --git a/include/extern.h b/include/extern.h index 19f00a20d..2f36c3d74 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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)); diff --git a/src/dbridge.c b/src/dbridge.c index 6d34f215c..c900be04e 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -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; diff --git a/src/dig.c b/src/dig.c index 6fd4b3464..80f766ba9 100644 --- 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"); diff --git a/src/do.c b/src/do.c index 4681760f8..532e3e7c5 100644 --- 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; diff --git a/src/eat.c b/src/eat.c index 90efd5638..00173e583 100644 --- 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; diff --git a/src/hack.c b/src/hack.c index 30f26c969..b656c4e5d 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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 */ diff --git a/src/polyself.c b/src/polyself.c index b5ea0d5a0..41f16548e 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -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 && diff --git a/src/trap.c b/src/trap.c index 9c4ab31f4..726298a5a 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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) {