if(Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)/* in bubble */) {
You_cant("write in thin air!");
return(0);
- } else if (closed_door(u.ux, u.uy) || !accessible(u.ux, u.uy)) {
+ } else if (!accessible(u.ux, u.uy)) {
/* stone, tree, wall, secret corridor, pool, lava, bars */
You_cant("write here.");
return 0;
-/* SCCS Id: @(#)mail.c 3.5 2006/04/14 */
+/* SCCS Id: @(#)mail.c 3.5 2006/12/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
for (y = u.uy-1; y <= u.uy+1; y++) {
if (!isok(x, y) || (x == u.ux && y == u.uy)) continue;
- if (ACCESSIBLE(levl[x][y].typ) && !MON_AT(x,y)) {
+ if (accessible(x, y) && !MON_AT(x,y)) {
distance = dist2(x,y,startp->x,startp->y);
if (min_distance < 0 || distance < min_distance ||
(distance == min_distance && rn2(2))) {
-/* SCCS Id: @(#)monmove.c 3.5 2006/08/16 */
+/* SCCS Id: @(#)monmove.c 3.5 2006/12/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
accessible(x, y)
register int x, y;
{
- return((boolean)(ACCESSIBLE(levl[x][y].typ) && !closed_door(x, y)));
+ int levtyp = levl[x][y].typ;
+
+ if (levtyp == DRAWBRIDGE_UP) {
+ /* use underlying terrain in front of closed drawbridge */
+ switch (levl[x][y].drawbridgemask & DB_UNDER) {
+ case DB_MOAT: levtyp = MOAT; break;
+ case DB_LAVA: levtyp = LAVAPOOL; break;
+ case DB_ICE: levtyp = ICE; break;
+ case DB_FLOOR: levtyp = ROOM; break;
+ }
+ }
+ return (boolean)(ACCESSIBLE(levtyp) && !closed_door(x, y));
}
/* decide where the monster thinks you are standing */
|| (disp != 2 && mx == mtmp->mx && my == mtmp->my)
|| ((mx != u.ux || my != u.uy) &&
!passes_walls(mtmp->data) &&
- (!ACCESSIBLE(levl[mx][my].typ) ||
- (closed_door(mx, my) &&
- !(can_ooze(mtmp) || can_fog(mtmp)))))
+ !(accessible(mx, my) ||
+ (closed_door(mx, my) &&
+ (can_ooze(mtmp) || can_fog(mtmp)))))
|| !couldsee(mx, my));
} else {
found_you:
-/* SCCS Id: @(#)steed.c 3.5 2006/10/11 */
+/* SCCS Id: @(#)steed.c 3.5 2006/12/13 */
/* Copyright (c) Kevin Hugo, 1998-1999. */
/* NetHack may be freely redistributed. See license for details. */
for (y = u.uy-1; y <= u.uy+1; y++) {
if (!isok(x, y) || (x == u.ux && y == u.uy)) continue;
- if (ACCESSIBLE(levl[x][y].typ) &&
- !MON_AT(x,y) && !closed_door(x,y)) {
+ if (accessible(x, y) && !MON_AT(x,y)) {
distance = distu(x,y);
if (min_distance < 0 || distance < min_distance ||
(distance == min_distance && rn2(2))) {
-/* SCCS Id: @(#)teleport.c 3.5 2006/08/05 */
+/* SCCS Id: @(#)teleport.c 3.5 2006/12/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
return (is_flyer(mdat) || likes_lava(mdat));
}
if (passes_walls(mdat) && may_passwall(x,y)) return TRUE;
+ if (amorphous(mdat) && closed_door(x,y)) return TRUE;
}
- if (!ACCESSIBLE(levl[x][y].typ)) {
+ if (!accessible(x, y)) {
if (!(is_pool(x,y) && ignorewater)) return FALSE;
}
- if (closed_door(x, y) && (!mdat || !amorphous(mdat)))
- return FALSE;
if (sobj_at(BOULDER, x, y) && (!mdat || !throws_rocks(mdat)))
return FALSE;
return TRUE;