rename IS_ROCK() macro to IS_OBSTRUCTED()

It has included trees since they were added, so give it a
more fitting name.
This commit is contained in:
nhmall
2024-11-09 11:12:42 -05:00
parent f1743d0e5c
commit 1dbba0f63b
23 changed files with 67 additions and 67 deletions
+2 -2
View File
@@ -103,9 +103,9 @@ enum levl_typ_types {
*/ */
#define IS_WALL(typ) ((typ) && (typ) <= DBWALL) #define IS_WALL(typ) ((typ) && (typ) <= DBWALL)
#define IS_STWALL(typ) ((typ) <= DBWALL) /* STONE <= (typ) <= DBWALL */ #define IS_STWALL(typ) ((typ) <= DBWALL) /* STONE <= (typ) <= DBWALL */
#define IS_ROCK(typ) ((typ) < POOL) /* absolutely nonaccessible */ #define IS_OBSTRUCTED(typ) ((typ) < POOL) /* absolutely nonaccessible */
#define IS_DOOR(typ) ((typ) == DOOR) #define IS_DOOR(typ) ((typ) == DOOR)
#define IS_DOORJOIN(typ) (IS_ROCK(typ) || (typ) == IRONBARS) #define IS_DOORJOIN(typ) (IS_OBSTRUCTED(typ) || (typ) == IRONBARS)
#define IS_TREE(typ) \ #define IS_TREE(typ) \
((typ) == TREE || (svl.level.flags.arboreal && (typ) == STONE)) ((typ) == TREE || (svl.level.flags.arboreal && (typ) == STONE))
#define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */ #define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */
+2 -2
View File
@@ -2512,7 +2512,7 @@ figurine_location_checks(struct obj *obj, coord *cc, boolean quietly)
You("cannot put the figurine there."); You("cannot put the figurine there.");
return FALSE; return FALSE;
} }
if (IS_ROCK(levl[x][y].typ) if (IS_OBSTRUCTED(levl[x][y].typ)
&& !(passes_walls(&mons[obj->corpsenm]) && may_passwall(x, y))) { && !(passes_walls(&mons[obj->corpsenm]) && may_passwall(x, y))) {
if (!quietly) if (!quietly)
You("cannot place a figurine in %s!", You("cannot place a figurine in %s!",
@@ -2829,7 +2829,7 @@ use_trap(struct obj *otmp)
else if (On_stairs(u.ux, u.uy)) { else if (On_stairs(u.ux, u.uy)) {
stairway *stway = stairway_at(u.ux, u.uy); stairway *stway = stairway_at(u.ux, u.uy);
what = stway->isladder ? "on the ladder" : "on the stairs"; what = stway->isladder ? "on the ladder" : "on the stairs";
} else if (IS_FURNITURE(levtyp) || IS_ROCK(levtyp) } else if (IS_FURNITURE(levtyp) || IS_OBSTRUCTED(levtyp)
|| closed_door(u.ux, u.uy) || t_at(u.ux, u.uy)) || closed_door(u.ux, u.uy) || t_at(u.ux, u.uy))
what = "here"; what = "here";
else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))
+1 -1
View File
@@ -609,7 +609,7 @@ drag_ball(coordxy x, coordxy y, int *bc_control,
(distmin(x, y, chx, chy) <= 1 \ (distmin(x, y, chx, chy) <= 1 \
&& distmin(chx, chy, uball->ox, uball->oy) <= 1) && distmin(chx, chy, uball->ox, uball->oy) <= 1)
#define IS_CHAIN_ROCK(x, y) \ #define IS_CHAIN_ROCK(x, y) \
(IS_ROCK(levl[x][y].typ) \ (IS_OBSTRUCTED(levl[x][y].typ) \
|| (IS_DOOR(levl[x][y].typ) \ || (IS_DOOR(levl[x][y].typ) \
&& (levl[x][y].doormask & (D_CLOSED | D_LOCKED)))) && (levl[x][y].doormask & (D_CLOSED | D_LOCKED))))
/* /*
+11 -11
View File
@@ -56,7 +56,7 @@ mkcavepos(coordxy x, coordxy y, int dist, boolean waslit, boolean rockit)
if (rockit) { if (rockit) {
struct monst *mtmp; struct monst *mtmp;
if (IS_ROCK(lev->typ)) if (IS_OBSTRUCTED(lev->typ))
return; return;
if (t_at(x, y)) if (t_at(x, y))
return; /* don't cover the portal */ return; /* don't cover the portal */
@@ -186,7 +186,7 @@ dig_typ(struct obj *otmp, coordxy x, coordxy y)
? DIGTYP_DOOR ? DIGTYP_DOOR
: IS_TREE(levl[x][y].typ) : IS_TREE(levl[x][y].typ)
? (ispick ? DIGTYP_UNDIGGABLE : DIGTYP_TREE) ? (ispick ? DIGTYP_UNDIGGABLE : DIGTYP_TREE)
: (ispick && IS_ROCK(levl[x][y].typ) : (ispick && IS_OBSTRUCTED(levl[x][y].typ)
&& (!svl.level.flags.arboreal && (!svl.level.flags.arboreal
|| IS_WALL(levl[x][y].typ))) || IS_WALL(levl[x][y].typ)))
? DIGTYP_ROCK ? DIGTYP_ROCK
@@ -227,7 +227,7 @@ dig_check(struct monst *madeby, coordxy x, coordxy y)
return DIGCHECK_FAIL_AIRLEVEL; return DIGCHECK_FAIL_AIRLEVEL;
} else if (Is_waterlevel(&u.uz)) { } else if (Is_waterlevel(&u.uz)) {
return DIGCHECK_FAIL_WATERLEVEL; return DIGCHECK_FAIL_WATERLEVEL;
} else if ((IS_ROCK(levl[x][y].typ) && levl[x][y].typ != SDOOR } else if ((IS_OBSTRUCTED(levl[x][y].typ) && levl[x][y].typ != SDOOR
&& (levl[x][y].wall_info & W_NONDIGGABLE) != 0)) { && (levl[x][y].wall_info & W_NONDIGGABLE) != 0)) {
return DIGCHECK_FAIL_TOOHARD; return DIGCHECK_FAIL_TOOHARD;
} else if (ttmp && undestroyable_trap(ttmp->ttyp)) { } else if (ttmp && undestroyable_trap(ttmp->ttyp)) {
@@ -328,7 +328,7 @@ dig(void)
pline("This tree seems to be petrified."); pline("This tree seems to be petrified.");
return 0; return 0;
} }
if (IS_ROCK(lev->typ) && !may_dig(dpx, dpy) if (IS_OBSTRUCTED(lev->typ) && !may_dig(dpx, dpy)
&& dig_typ(uwep, dpx, dpy) == DIGTYP_ROCK) { && dig_typ(uwep, dpx, dpy) == DIGTYP_ROCK) {
pline("This %s is too hard to %s.", pline("This %s is too hard to %s.",
is_db_wall(dpx, dpy) ? "drawbridge" : "wall", verb); is_db_wall(dpx, dpy) ? "drawbridge" : "wall", verb);
@@ -561,7 +561,7 @@ dig(void)
return 0; return 0;
} }
} else if (dig_target == DIGTYP_UNDIGGABLE } else if (dig_target == DIGTYP_UNDIGGABLE
|| (dig_target == DIGTYP_ROCK && !IS_ROCK(lev->typ))) || (dig_target == DIGTYP_ROCK && !IS_OBSTRUCTED(lev->typ)))
return 0; /* statue or boulder got taken */ return 0; /* statue or boulder got taken */
if (!gd.did_dig_msg) { if (!gd.did_dig_msg) {
@@ -913,7 +913,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc)
old_typ = lev->typ; old_typ = lev->typ;
if ((ttmp && (undestroyable_trap(ttmp->ttyp) || nohole)) if ((ttmp && (undestroyable_trap(ttmp->ttyp) || nohole))
|| (IS_ROCK(old_typ) && old_typ != SDOOR || (IS_OBSTRUCTED(old_typ) && old_typ != SDOOR
&& (lev->wall_info & W_NONDIGGABLE) != 0)) { && (lev->wall_info & W_NONDIGGABLE) != 0)) {
pline_The("%s %shere is too hard to dig in.", surface(dig_x, dig_y), pline_The("%s %shere is too hard to dig in.", surface(dig_x, dig_y),
(dig_x != u.ux || dig_y != u.uy) ? "t" : ""); (dig_x != u.ux || dig_y != u.uy) ? "t" : "");
@@ -1230,7 +1230,7 @@ use_pick_axe2(struct obj *obj)
(void) fire_damage(uwep, FALSE, rx, ry); (void) fire_damage(uwep, FALSE, rx, ry);
} else if (IS_TREE(lev->typ)) { } else if (IS_TREE(lev->typ)) {
You("need an axe to cut down a tree."); You("need an axe to cut down a tree.");
} else if (IS_ROCK(lev->typ)) { } else if (IS_OBSTRUCTED(lev->typ)) {
You("need a pick to dig rock."); You("need a pick to dig rock.");
} else if ((boulder = sobj_at(BOULDER, rx, ry)) != 0 } else if ((boulder = sobj_at(BOULDER, rx, ry)) != 0
|| sobj_at(STATUE, rx, ry)) { || sobj_at(STATUE, rx, ry)) {
@@ -1398,7 +1398,7 @@ watch_dig(struct monst *mtmp, coordxy x, coordxy y, boolean zap)
str = "door"; str = "door";
else if (IS_TREE(lev->typ)) else if (IS_TREE(lev->typ))
str = "tree"; str = "tree";
else if (IS_ROCK(lev->typ)) else if (IS_OBSTRUCTED(lev->typ))
str = "wall"; str = "wall";
else else
str = "fountain"; str = "fountain";
@@ -1452,7 +1452,7 @@ mdig_tunnel(struct monst *mtmp)
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
draft_message(FALSE); /* "You feel a draft." */ draft_message(FALSE); /* "You feel a draft." */
return FALSE; return FALSE;
} else if (!IS_ROCK(here->typ) && !IS_TREE(here->typ)) { /* no dig */ } else if (!IS_OBSTRUCTED(here->typ) && !IS_TREE(here->typ)) { /* no dig */
return FALSE; return FALSE;
} }
@@ -1709,7 +1709,7 @@ zap_dig(void)
pline_The("rock glows then fades."); pline_The("rock glows then fades.");
break; break;
} }
} else if (IS_ROCK(room->typ)) { } else if (IS_OBSTRUCTED(room->typ)) {
if (!may_dig(zx, zy)) if (!may_dig(zx, zy))
break; break;
if (IS_WALL(room->typ) || room->typ == SDOOR) { if (IS_WALL(room->typ) || room->typ == SDOOR) {
@@ -1727,7 +1727,7 @@ zap_dig(void)
} else if (IS_TREE(room->typ)) { } else if (IS_TREE(room->typ)) {
room->typ = ROOM, room->flags = 0; room->typ = ROOM, room->flags = 0;
digdepth -= 2; digdepth -= 2;
} else { /* IS_ROCK but not IS_WALL or SDOOR */ } else { /* IS_OBSTRUCTED but not IS_WALL or SDOOR */
room->typ = CORR, room->flags = 0; room->typ = CORR, room->flags = 0;
digdepth--; digdepth--;
} }
+2 -2
View File
@@ -783,7 +783,7 @@ feel_location(coordxy x, coordxy y)
* + Room/water positions * + Room/water positions
* + Everything else (hallways!) * + Everything else (hallways!)
*/ */
if (IS_ROCK(lev->typ) if (IS_OBSTRUCTED(lev->typ)
|| (IS_DOOR(lev->typ) || (IS_DOOR(lev->typ)
&& (lev->doormask & (D_LOCKED | D_CLOSED)))) { && (lev->doormask & (D_LOCKED | D_CLOSED)))) {
map_background(x, y, 1); map_background(x, y, 1);
@@ -3101,7 +3101,7 @@ check_pos(coordxy x, coordxy y, int which)
if (!isok(x, y)) if (!isok(x, y))
return which; return which;
type = levl[x][y].typ; type = levl[x][y].typ;
if (IS_ROCK(type) || type == CORR || type == SCORR) if (IS_OBSTRUCTED(type) || type == CORR || type == SCORR)
return which; return which;
return 0; return 0;
} }
+1 -1
View File
@@ -1362,7 +1362,7 @@ can_reach_location(
continue; continue;
if (dist2(i, j, fx, fy) >= dist) if (dist2(i, j, fx, fy) >= dist)
continue; continue;
if (IS_ROCK(levl[i][j].typ) && !passes_walls(mon->data) if (IS_OBSTRUCTED(levl[i][j].typ) && !passes_walls(mon->data)
&& (!may_dig(i, j) || !tunnels(mon->data) && (!may_dig(i, j) || !tunnels(mon->data)
/* tunnelling monsters can't do that on the rogue level */ /* tunnelling monsters can't do that on the rogue level */
|| Is_rogue_level(&u.uz))) || Is_rogue_level(&u.uz)))
+4 -4
View File
@@ -612,9 +612,9 @@ really_kick_object(coordxy x, coordxy y)
Norep("You kick %s.", Norep("You kick %s.",
!isgold ? singular(gk.kickedobj, doname) : doname(gk.kickedobj)); !isgold ? singular(gk.kickedobj, doname) : doname(gk.kickedobj));
if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)) { if (IS_OBSTRUCTED(levl[x][y].typ) || closed_door(x, y)) {
if ((!martial() && rn2(20) > ACURR(A_DEX)) if ((!martial() && rn2(20) > ACURR(A_DEX))
|| IS_ROCK(levl[u.ux][u.uy].typ) || closed_door(u.ux, u.uy)) { || IS_OBSTRUCTED(levl[u.ux][u.uy].typ) || closed_door(u.ux, u.uy)) {
if (Blind) if (Blind)
pline("It doesn't come loose."); pline("It doesn't come loose.");
else else
@@ -805,7 +805,7 @@ kickstr(char *buf, const char *kickobjnam)
what = "a tree"; what = "a tree";
else if (IS_STWALL(gm.maploc->typ)) else if (IS_STWALL(gm.maploc->typ))
what = "a wall"; what = "a wall";
else if (IS_ROCK(gm.maploc->typ)) else if (IS_OBSTRUCTED(gm.maploc->typ))
what = "a rock"; what = "a rock";
else if (IS_THRONE(gm.maploc->typ)) else if (IS_THRONE(gm.maploc->typ))
what = "a throne"; what = "a throne";
@@ -1360,7 +1360,7 @@ dokick(void)
* reachable for bracing purposes * reachable for bracing purposes
* Possible extension: allow bracing against stuff on the side? * Possible extension: allow bracing against stuff on the side?
*/ */
if (isok(xx, yy) && !IS_ROCK(levl[xx][yy].typ) if (isok(xx, yy) && !IS_OBSTRUCTED(levl[xx][yy].typ)
&& !IS_DOOR(levl[xx][yy].typ) && !IS_DOOR(levl[xx][yy].typ)
&& (!Is_airlevel(&u.uz) || !OBJ_AT(xx, yy))) { && (!Is_airlevel(&u.uz) || !OBJ_AT(xx, yy))) {
You("have nothing to brace yourself against."); You("have nothing to brace yourself against.");
+2 -2
View File
@@ -785,7 +785,7 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
&& (levl[x][y].doormask & D_ISOPEN) && (levl[x][y].doormask & D_ISOPEN)
&& (u.ux - x) && (u.uy - y)); && (u.ux - x) && (u.uy - y));
if (IS_ROCK(levl[x][y].typ) || closed_door(x, y) || odoor_diag) { if (IS_OBSTRUCTED(levl[x][y].typ) || closed_door(x, y) || odoor_diag) {
const char *s; const char *s;
if (odoor_diag) if (odoor_diag)
@@ -793,7 +793,7 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y)
pline("Ouch!"); pline("Ouch!");
if (IS_TREE(levl[x][y].typ)) if (IS_TREE(levl[x][y].typ))
s = "bumping into a tree"; s = "bumping into a tree";
else if (IS_ROCK(levl[x][y].typ)) else if (IS_OBSTRUCTED(levl[x][y].typ))
s = "bumping into a wall"; s = "bumping into a wall";
else else
s = "bumping into a door"; s = "bumping into a door";
+14 -14
View File
@@ -151,8 +151,8 @@ could_move_onto_boulder(coordxy sx, coordxy sy)
/* can if a giant, unless doing so allows hero to pass into a /* can if a giant, unless doing so allows hero to pass into a
diagonal squeeze at the same time */ diagonal squeeze at the same time */
if (throws_rocks(gy.youmonst.data)) if (throws_rocks(gy.youmonst.data))
return (!u.dx || !u.dy || !(IS_ROCK(levl[u.ux][sy].typ) return (!u.dx || !u.dy || !(IS_OBSTRUCTED(levl[u.ux][sy].typ)
&& IS_ROCK(levl[sx][u.uy].typ))); && IS_OBSTRUCTED(levl[sx][u.uy].typ)));
/* can if tiny (implies carrying very little else couldn't move at all) */ /* can if tiny (implies carrying very little else couldn't move at all) */
if (verysmall(gy.youmonst.data)) if (verysmall(gy.youmonst.data))
return TRUE; return TRUE;
@@ -427,7 +427,7 @@ moverock_core(coordxy sx, coordxy sy)
pline("You're too small to push that %s.", xname(otmp)); pline("You're too small to push that %s.", xname(otmp));
return cannot_push(otmp, sx, sy); return cannot_push(otmp, sx, sy);
} }
if (isok(rx, ry) && !IS_ROCK(levl[rx][ry].typ) if (isok(rx, ry) && !IS_OBSTRUCTED(levl[rx][ry].typ)
&& levl[rx][ry].typ != IRONBARS && levl[rx][ry].typ != IRONBARS
&& (!IS_DOOR(levl[rx][ry].typ) || !(u.dx && u.dy) && (!IS_DOOR(levl[rx][ry].typ) || !(u.dx && u.dy)
|| doorless_door(rx, ry)) && !sobj_at(BOULDER, rx, ry)) { || doorless_door(rx, ry)) && !sobj_at(BOULDER, rx, ry)) {
@@ -632,7 +632,7 @@ still_chewing(coordxy x, coordxy y)
sizeof (struct dig_info)); sizeof (struct dig_info));
if (!boulder if (!boulder
&& ((IS_ROCK(lev->typ) && !may_dig(x, y)) && ((IS_OBSTRUCTED(lev->typ) && !may_dig(x, y))
/* may_dig() checks W_NONDIGGABLE but doesn't handle iron bars */ /* may_dig() checks W_NONDIGGABLE but doesn't handle iron bars */
|| (lev->typ == IRONBARS && (lev->wall_info & W_NONDIGGABLE)))) { || (lev->typ == IRONBARS && (lev->wall_info & W_NONDIGGABLE)))) {
You("hurt your teeth on the %s.", You("hurt your teeth on the %s.",
@@ -661,7 +661,7 @@ still_chewing(coordxy x, coordxy y)
assign_level(&svc.context.digging.level, &u.uz); assign_level(&svc.context.digging.level, &u.uz);
/* solid rock takes more work & time to dig through */ /* solid rock takes more work & time to dig through */
svc.context.digging.effort = svc.context.digging.effort =
(IS_ROCK(lev->typ) && !IS_TREE(lev->typ) ? 30 : 60) + u.udaminc; (IS_OBSTRUCTED(lev->typ) && !IS_TREE(lev->typ) ? 30 : 60) + u.udaminc;
You("start chewing %s %s.", You("start chewing %s %s.",
(boulder || IS_TREE(lev->typ) || lev->typ == IRONBARS) (boulder || IS_TREE(lev->typ) || lev->typ == IRONBARS)
? "on a" ? "on a"
@@ -670,7 +670,7 @@ still_chewing(coordxy x, coordxy y)
? "boulder" ? "boulder"
: IS_TREE(lev->typ) : IS_TREE(lev->typ)
? "tree" ? "tree"
: IS_ROCK(lev->typ) : IS_OBSTRUCTED(lev->typ)
? "rock" ? "rock"
: (lev->typ == IRONBARS) : (lev->typ == IRONBARS)
? "bar" ? "bar"
@@ -685,7 +685,7 @@ still_chewing(coordxy x, coordxy y)
? "boulder" ? "boulder"
: IS_TREE(lev->typ) : IS_TREE(lev->typ)
? "tree" ? "tree"
: IS_ROCK(lev->typ) : IS_OBSTRUCTED(lev->typ)
? "rock" ? "rock"
: (lev->typ == IRONBARS) : (lev->typ == IRONBARS)
? "bars" ? "bars"
@@ -701,7 +701,7 @@ still_chewing(coordxy x, coordxy y)
"ate for the first time, by chewing through %s", "ate for the first time, by chewing through %s",
boulder ? "a boulder" boulder ? "a boulder"
: IS_TREE(lev->typ) ? "a tree" : IS_TREE(lev->typ) ? "a tree"
: IS_ROCK(lev->typ) ? "rock" : IS_OBSTRUCTED(lev->typ) ? "rock"
: (lev->typ == IRONBARS) ? "iron bars" : (lev->typ == IRONBARS) ? "iron bars"
: "a door"); : "a door");
u.uhunger += rnd(20); u.uhunger += rnd(20);
@@ -717,7 +717,7 @@ still_chewing(coordxy x, coordxy y)
* *
* [perhaps use does_block() below (from vision.c)] * [perhaps use does_block() below (from vision.c)]
*/ */
if (IS_ROCK(lev->typ) || closed_door(x, y) if (IS_OBSTRUCTED(lev->typ) || closed_door(x, y)
|| sobj_at(BOULDER, x, y)) { || sobj_at(BOULDER, x, y)) {
block_point(x, y); /* delobj will unblock the point */ block_point(x, y); /* delobj will unblock the point */
/* reset dig state */ /* reset dig state */
@@ -916,7 +916,7 @@ boolean
bad_rock(struct permonst *mdat, coordxy x, coordxy y) bad_rock(struct permonst *mdat, coordxy x, coordxy y)
{ {
return (boolean) ((Sokoban && sobj_at(BOULDER, x, y)) return (boolean) ((Sokoban && sobj_at(BOULDER, x, y))
|| (IS_ROCK(levl[x][y].typ) || (IS_OBSTRUCTED(levl[x][y].typ)
&& (!tunnels(mdat) || needspick(mdat) && (!tunnels(mdat) || needspick(mdat)
|| !may_dig(x, y)) || !may_dig(x, y))
&& !(passes_walls(mdat) && may_passwall(x, y)))); && !(passes_walls(mdat) && may_passwall(x, y))));
@@ -979,7 +979,7 @@ test_move(
/* /*
* Check for physical obstacles. First, the place we are going. * Check for physical obstacles. First, the place we are going.
*/ */
if (IS_ROCK(tmpr->typ) || tmpr->typ == IRONBARS) { if (IS_OBSTRUCTED(tmpr->typ) || tmpr->typ == IRONBARS) {
if (Blind && mode == DO_MOVE) if (Blind && mode == DO_MOVE)
feel_location(x, y); feel_location(x, y);
if (Passes_walls && may_passwall(x, y)) { if (Passes_walls && may_passwall(x, y)) {
@@ -2878,7 +2878,7 @@ domove_core(void)
reset_occupations(); reset_occupations();
if (svc.context.run) { if (svc.context.run) {
if (svc.context.run < 8) if (svc.context.run < 8)
if (IS_DOOR(tmpr->typ) || IS_ROCK(tmpr->typ) if (IS_DOOR(tmpr->typ) || IS_OBSTRUCTED(tmpr->typ)
|| IS_FURNITURE(tmpr->typ)) || IS_FURNITURE(tmpr->typ))
nomul(0); nomul(0);
} }
@@ -3033,7 +3033,7 @@ void
switch_terrain(void) switch_terrain(void)
{ {
struct rm *lev = &levl[u.ux][u.uy]; struct rm *lev = &levl[u.ux][u.uy];
boolean blocklev = (IS_ROCK(lev->typ) || closed_door(u.ux, u.uy) boolean blocklev = (IS_OBSTRUCTED(lev->typ) || closed_door(u.ux, u.uy)
|| IS_WATERWALL(lev->typ) || IS_WATERWALL(lev->typ)
|| lev->typ == LAVAWALL), || lev->typ == LAVAWALL),
was_levitating = !!Levitation, was_flying = !!Flying; was_levitating = !!Levitation, was_flying = !!Flying;
@@ -3801,7 +3801,7 @@ lookaround(void)
} }
/* more uninteresting terrain */ /* more uninteresting terrain */
if (IS_ROCK(levl[x][y].typ) || levl[x][y].typ == ROOM if (IS_OBSTRUCTED(levl[x][y].typ) || levl[x][y].typ == ROOM
|| IS_AIR(levl[x][y].typ) || levl[x][y].typ == ICE) { || IS_AIR(levl[x][y].typ) || levl[x][y].typ == ICE) {
continue; continue;
} else if (closed_door(x, y) || (mtmp && is_door_mappear(mtmp))) { } else if (closed_door(x, y) || (mtmp && is_door_mappear(mtmp))) {
+2 -2
View File
@@ -818,7 +818,7 @@ engulf_target(struct monst *magr, struct monst *mdef)
dy = (mdef == &gy.youmonst) ? u.uy : mdef->my; dy = (mdef == &gy.youmonst) ? u.uy : mdef->my;
lev = &levl[dx][dy]; lev = &levl[dx][dy];
if (!(udef ? Passes_walls : passes_walls(mdef->data)) if (!(udef ? Passes_walls : passes_walls(mdef->data))
&& (IS_ROCK(lev->typ) || closed_door(dx, dy) || IS_TREE(lev->typ) && (IS_OBSTRUCTED(lev->typ) || closed_door(dx, dy) || IS_TREE(lev->typ)
/* not passes_bars(); engulfer isn't squeezing through */ /* not passes_bars(); engulfer isn't squeezing through */
|| (lev->typ == IRONBARS && !is_whirly(magr->data)))) || (lev->typ == IRONBARS && !is_whirly(magr->data))))
return FALSE; return FALSE;
@@ -826,7 +826,7 @@ engulf_target(struct monst *magr, struct monst *mdef)
ay = (magr == &gy.youmonst) ? u.uy : magr->my; ay = (magr == &gy.youmonst) ? u.uy : magr->my;
lev = &levl[ax][ay]; lev = &levl[ax][ay];
if (!(uatk ? Passes_walls : passes_walls(magr->data)) if (!(uatk ? Passes_walls : passes_walls(magr->data))
&& (IS_ROCK(lev->typ) || closed_door(ax, ay) || IS_TREE(lev->typ) && (IS_OBSTRUCTED(lev->typ) || closed_door(ax, ay) || IS_TREE(lev->typ)
|| (lev->typ == IRONBARS && !is_whirly(mdef->data)))) || (lev->typ == IRONBARS && !is_whirly(mdef->data))))
return FALSE; return FALSE;
+5 -5
View File
@@ -77,7 +77,7 @@ door_into_nonjoined(coordxy x, coordxy y)
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
tx = x + xdir[dirs_ord[i]]; tx = x + xdir[dirs_ord[i]];
ty = y + ydir[dirs_ord[i]]; ty = y + ydir[dirs_ord[i]];
if (!isok(tx, ty) || IS_ROCK(levl[tx][ty].typ)) if (!isok(tx, ty) || IS_OBSTRUCTED(levl[tx][ty].typ))
continue; continue;
/* Is this connecting to a room that doesn't want joining? */ /* Is this connecting to a room that doesn't want joining? */
@@ -1621,10 +1621,10 @@ okdoor(coordxy x, coordxy y)
boolean near_door = bydoor(x, y); boolean near_door = bydoor(x, y);
return ((levl[x][y].typ == HWALL || levl[x][y].typ == VWALL) return ((levl[x][y].typ == HWALL || levl[x][y].typ == VWALL)
&& ((isok(x - 1, y) && !IS_ROCK(levl[x - 1][y].typ)) && ((isok(x - 1, y) && !IS_OBSTRUCTED(levl[x - 1][y].typ))
|| (isok(x + 1, y) && !IS_ROCK(levl[x + 1][y].typ)) || (isok(x + 1, y) && !IS_OBSTRUCTED(levl[x + 1][y].typ))
|| (isok(x, y - 1) && !IS_ROCK(levl[x][y - 1].typ)) || (isok(x, y - 1) && !IS_OBSTRUCTED(levl[x][y - 1].typ))
|| (isok(x, y + 1) && !IS_ROCK(levl[x][y + 1].typ))) || (isok(x, y + 1) && !IS_OBSTRUCTED(levl[x][y + 1].typ)))
&& !near_door); && !near_door);
} }
+2 -2
View File
@@ -345,8 +345,8 @@ finish_map(
if (lit) { if (lit) {
for (i = 1; i < COLNO; i++) for (i = 1; i < COLNO; i++)
for (j = 0; j < ROWNO; j++) for (j = 0; j < ROWNO; j++)
if ((!IS_ROCK(fg_typ) && levl[i][j].typ == fg_typ) if ((!IS_OBSTRUCTED(fg_typ) && levl[i][j].typ == fg_typ)
|| (!IS_ROCK(bg_typ) && levl[i][j].typ == bg_typ) || (!IS_OBSTRUCTED(bg_typ) && levl[i][j].typ == bg_typ)
|| (bg_typ == TREE && levl[i][j].typ == bg_typ) || (bg_typ == TREE && levl[i][j].typ == bg_typ)
|| (walled && IS_WALL(levl[i][j].typ))) || (walled && IS_WALL(levl[i][j].typ)))
levl[i][j].lit = TRUE; levl[i][j].lit = TRUE;
+2 -2
View File
@@ -2170,12 +2170,12 @@ mfndpos(
if (nx == x && ny == y) if (nx == x && ny == y)
continue; continue;
ntyp = levl[nx][ny].typ; ntyp = levl[nx][ny].typ;
if (IS_ROCK(ntyp) if (IS_OBSTRUCTED(ntyp)
&& !((flag & ALLOW_WALL) && may_passwall(nx, ny)) && !((flag & ALLOW_WALL) && may_passwall(nx, ny))
&& !((IS_TREE(ntyp) ? treeok : rockok) && may_dig(nx, ny))) && !((IS_TREE(ntyp) ? treeok : rockok) && may_dig(nx, ny)))
continue; continue;
/* intelligent peacefuls avoid digging shop/temple walls */ /* intelligent peacefuls avoid digging shop/temple walls */
if (IS_ROCK(ntyp) && rockok if (IS_OBSTRUCTED(ntyp) && rockok
&& !mindless(mon->data) && (mon->mpeaceful || mon->mtame) && !mindless(mon->data) && (mon->mpeaceful || mon->mtame)
&& (*in_rooms(nx, ny, TEMPLE) || *in_rooms(nx, ny, SHOPBASE)) && (*in_rooms(nx, ny, TEMPLE) || *in_rooms(nx, ny, SHOPBASE))
&& !(*in_rooms(x, y, TEMPLE) || *in_rooms(x, y, SHOPBASE))) && !(*in_rooms(x, y, TEMPLE) || *in_rooms(x, y, SHOPBASE)))
+1 -1
View File
@@ -1174,7 +1174,7 @@ holds_up_web(coordxy x, coordxy y)
stairway *sway; stairway *sway;
if (!isok(x, y) if (!isok(x, y)
|| IS_ROCK(levl[x][y].typ) || IS_OBSTRUCTED(levl[x][y].typ)
|| ((levl[x][y].typ == STAIRS || levl[x][y].typ == LADDER) || ((levl[x][y].typ == STAIRS || levl[x][y].typ == LADDER)
&& (sway = stairway_at(x, y)) != 0 && sway->up) && (sway = stairway_at(x, y)) != 0 && sway->up)
|| levl[x][y].typ == IRONBARS) || levl[x][y].typ == IRONBARS)
+2 -2
View File
@@ -528,7 +528,7 @@ ucatchgem(
(/* missile hits edge of screen */ \ (/* missile hits edge of screen */ \
!isok(gb.bhitpos.x + dx, gb.bhitpos.y + dy) \ !isok(gb.bhitpos.x + dx, gb.bhitpos.y + dy) \
/* missile hits the wall */ \ /* missile hits the wall */ \
|| IS_ROCK(levl[gb.bhitpos.x + dx][gb.bhitpos.y + dy].typ) \ || IS_OBSTRUCTED(levl[gb.bhitpos.x + dx][gb.bhitpos.y + dy].typ) \
/* missile hit closed door */ \ /* missile hit closed door */ \
|| closed_door(gb.bhitpos.x + dx, gb.bhitpos.y + dy) \ || closed_door(gb.bhitpos.x + dx, gb.bhitpos.y + dy) \
/* missile might hit iron bars */ \ /* missile might hit iron bars */ \
@@ -1080,7 +1080,7 @@ breamu(struct monst *mtmp, struct attack *mattk)
staticfn boolean staticfn boolean
blocking_terrain(coordxy x, coordxy y) blocking_terrain(coordxy x, coordxy y)
{ {
if (!isok(x, y) || IS_ROCK(levl[x][y].typ) || closed_door(x, y) if (!isok(x, y) || IS_OBSTRUCTED(levl[x][y].typ) || closed_door(x, y)
|| is_waterwall(x, y) || levl[x][y].typ == LAVAWALL) || is_waterwall(x, y) || levl[x][y].typ == LAVAWALL)
return TRUE; return TRUE;
return FALSE; return FALSE;
+1 -1
View File
@@ -1840,7 +1840,7 @@ use_offensive(struct monst *mtmp)
for (y = mmy - 1; y <= mmy + 1; y++) { for (y = mmy - 1; y <= mmy + 1; y++) {
/* Is this a suitable spot? */ /* Is this a suitable spot? */
if (isok(x, y) && !closed_door(x, y) if (isok(x, y) && !closed_door(x, y)
&& !IS_ROCK(levl[x][y].typ) && !IS_AIR(levl[x][y].typ) && !IS_OBSTRUCTED(levl[x][y].typ) && !IS_AIR(levl[x][y].typ)
&& (((x == mmx) && (y == mmy)) ? !is_blessed : !is_cursed) && (((x == mmx) && (y == mmy)) ? !is_blessed : !is_cursed)
&& (x != u.ux || y != u.uy)) { && (x != u.ux || y != u.uy)) {
(void) drop_boulder_on_monster(x, y, confused, FALSE); (void) drop_boulder_on_monster(x, y, confused, FALSE);
+2 -2
View File
@@ -169,7 +169,7 @@ stuck_in_wall(void)
continue; continue;
y = u.uy + j; y = u.uy + j;
if (!isok(x, y) if (!isok(x, y)
|| (IS_ROCK(levl[x][y].typ) || (IS_OBSTRUCTED(levl[x][y].typ)
&& (levl[x][y].typ != SDOOR && levl[x][y].typ != SCORR)) && (levl[x][y].typ != SDOOR && levl[x][y].typ != SCORR))
|| (blocked_boulder(i, j) && !throws_rocks(gy.youmonst.data))) || (blocked_boulder(i, j) && !throws_rocks(gy.youmonst.data)))
++count; ++count;
@@ -2633,7 +2633,7 @@ blocked_boulder(int dx, int dy)
return TRUE; return TRUE;
if (!isok(nx, ny)) if (!isok(nx, ny))
return TRUE; return TRUE;
if (IS_ROCK(levl[nx][ny].typ)) if (IS_OBSTRUCTED(levl[nx][ny].typ))
return TRUE; return TRUE;
if (sobj_at(BOULDER, nx, ny)) if (sobj_at(BOULDER, nx, ny))
return TRUE; return TRUE;
+1 -1
View File
@@ -1850,7 +1850,7 @@ seffect_earth(struct obj **sobjp)
for (y = u.uy - 1; y <= u.uy + 1; y++) { for (y = u.uy - 1; y <= u.uy + 1; y++) {
/* Is this a suitable spot? */ /* Is this a suitable spot? */
if (isok(x, y) && !closed_door(x, y) if (isok(x, y) && !closed_door(x, y)
&& !IS_ROCK(levl[x][y].typ) && !IS_OBSTRUCTED(levl[x][y].typ)
&& !IS_AIR(levl[x][y].typ) && !IS_AIR(levl[x][y].typ)
&& (x != u.ux || y != u.uy)) { && (x != u.ux || y != u.uy)) {
nboulders += nboulders +=
+5 -5
View File
@@ -1291,7 +1291,7 @@ is_ok_location(coordxy x, coordxy y, getloc_flags_t humidity)
if (humidity & ANY_LOC) if (humidity & ANY_LOC)
return TRUE; return TRUE;
if ((humidity & SOLID) && IS_ROCK(typ)) if ((humidity & SOLID) && IS_OBSTRUCTED(typ))
return TRUE; return TRUE;
if ((humidity & (DRY|SPACELOC)) && SPACE_POS(typ)) { if ((humidity & (DRY|SPACELOC)) && SPACE_POS(typ)) {
@@ -1758,7 +1758,7 @@ create_door(room_door *dd, struct mkroom *broom)
y = broom->ly - 1; y = broom->ly - 1;
x = broom->lx + ((dpos == -1) ? rn2(1 + broom->hx - broom->lx) x = broom->lx + ((dpos == -1) ? rn2(1 + broom->hx - broom->lx)
: dpos); : dpos);
if (!isok(x, y - 1) || IS_ROCK(levl[x][y - 1].typ)) if (!isok(x, y - 1) || IS_OBSTRUCTED(levl[x][y - 1].typ))
continue; continue;
break; break;
case 1: case 1:
@@ -1767,7 +1767,7 @@ create_door(room_door *dd, struct mkroom *broom)
y = broom->hy + 1; y = broom->hy + 1;
x = broom->lx + ((dpos == -1) ? rn2(1 + broom->hx - broom->lx) x = broom->lx + ((dpos == -1) ? rn2(1 + broom->hx - broom->lx)
: dpos); : dpos);
if (!isok(x, y + 1) || IS_ROCK(levl[x][y + 1].typ)) if (!isok(x, y + 1) || IS_OBSTRUCTED(levl[x][y + 1].typ))
continue; continue;
break; break;
case 2: case 2:
@@ -1776,7 +1776,7 @@ create_door(room_door *dd, struct mkroom *broom)
x = broom->lx - 1; x = broom->lx - 1;
y = broom->ly + ((dpos == -1) ? rn2(1 + broom->hy - broom->ly) y = broom->ly + ((dpos == -1) ? rn2(1 + broom->hy - broom->ly)
: dpos); : dpos);
if (!isok(x - 1, y) || IS_ROCK(levl[x - 1][y].typ)) if (!isok(x - 1, y) || IS_OBSTRUCTED(levl[x - 1][y].typ))
continue; continue;
break; break;
case 3: case 3:
@@ -1785,7 +1785,7 @@ create_door(room_door *dd, struct mkroom *broom)
x = broom->hx + 1; x = broom->hx + 1;
y = broom->ly + ((dpos == -1) ? rn2(1 + broom->hy - broom->ly) y = broom->ly + ((dpos == -1) ? rn2(1 + broom->hy - broom->ly)
: dpos); : dpos);
if (!isok(x + 1, y) || IS_ROCK(levl[x + 1][y].typ)) if (!isok(x + 1, y) || IS_OBSTRUCTED(levl[x + 1][y].typ))
continue; continue;
break; break;
default: default:
+1 -1
View File
@@ -3383,7 +3383,7 @@ launch_obj(
const char *bmsg = " as one boulder sets another in motion"; const char *bmsg = " as one boulder sets another in motion";
coordxy fx = x + dx, fy = y + dy; coordxy fx = x + dx, fy = y + dy;
if (!isok(fx, fy) || !dist || IS_ROCK(levl[fx][fy].typ)) if (!isok(fx, fy) || !dist || IS_OBSTRUCTED(levl[fx][fy].typ))
bmsg = " as one boulder hits another"; bmsg = " as one boulder hits another";
Soundeffect(se_loud_crash, 80); Soundeffect(se_loud_crash, 80);
+1 -1
View File
@@ -469,7 +469,7 @@ do_attack(struct monst *mtmp)
*/ */
boolean foo = (Punished || !rn2(7) boolean foo = (Punished || !rn2(7)
|| (is_longworm(mtmp->data) && mtmp->wormno) || (is_longworm(mtmp->data) && mtmp->wormno)
|| (IS_ROCK(levl[u.ux][u.uy].typ) || (IS_OBSTRUCTED(levl[u.ux][u.uy].typ)
&& !passes_walls(mtmp->data))), && !passes_walls(mtmp->data))),
inshop = FALSE; inshop = FALSE;
char *p; char *p;
+1 -1
View File
@@ -109,7 +109,7 @@ clear_fcorr(struct monst *grd, boolean forceshow)
/* only give encased message if hero is still alive (might get here /* only give encased message if hero is still alive (might get here
via paygd() -> mongone() -> grddead() when game is over; via paygd() -> mongone() -> grddead() when game is over;
died: no message, quit: message) */ died: no message, quit: message) */
if (IS_ROCK(levl[u.ux][u.uy].typ) && (Upolyd ? u.mh : u.uhp) > 0 if (IS_OBSTRUCTED(levl[u.ux][u.uy].typ) && (Upolyd ? u.mh : u.uhp) > 0
&& !silently) && !silently)
You("are encased in rock."); You("are encased in rock.");
return TRUE; return TRUE;
+2 -2
View File
@@ -154,7 +154,7 @@ does_block(int x, int y, struct rm *lev)
#endif #endif
/* Features that block . . */ /* Features that block . . */
if (IS_ROCK(lev->typ) || lev->typ == TREE if (IS_OBSTRUCTED(lev->typ) || lev->typ == TREE
|| (IS_DOOR(lev->typ) || (IS_DOOR(lev->typ)
&& (lev->doormask & (D_CLOSED | D_LOCKED | D_TRAPPED)))) && (lev->doormask & (D_CLOSED | D_LOCKED | D_TRAPPED))))
return 1; return 1;
@@ -221,7 +221,7 @@ vision_reset(void)
block = TRUE; /* location (0,y) is always stone; it's !isok() */ block = TRUE; /* location (0,y) is always stone; it's !isok() */
lev = &levl[1][y]; lev = &levl[1][y];
for (x = 1; x < COLNO; x++, lev += ROWNO) for (x = 1; x < COLNO; x++, lev += ROWNO)
if (block != (IS_ROCK(lev->typ) || does_block(x, y, lev))) { if (block != (IS_OBSTRUCTED(lev->typ) || does_block(x, y, lev))) {
if (block) { if (block) {
for (i = dig_left; i < x; i++) { for (i = dig_left; i < x; i++) {
left_ptrs[y][i] = dig_left; left_ptrs[y][i] = dig_left;