};
#define is_pit(ttyp) ((ttyp) == PIT || (ttyp) == SPIKED_PIT)
+#define is_hole(ttyp) ((ttyp) == HOLE || (ttyp) == TRAPDOOR)
#endif /* TRAP_H */
|| !is_pool(uball->ox, uball->oy)
|| levl[uball->ox][uball->oy].typ == POOL))
|| ((t = t_at(uchain->ox, uchain->oy))
- && (is_pit(t->ttyp) || t->ttyp == HOLE
- || t->ttyp == TRAPDOOR))) {
+ && (is_pit(t->ttyp) || is_hole(t->ttyp)))) {
if (Levitation) {
You_feel("a tug from the iron ball.");
if (t)
&& (is_pool(x, y)
|| ((t = t_at(x, y))
&& (is_pit(t->ttyp)
- || t->ttyp == TRAPDOOR || t->ttyp == HOLE)))) {
+ || is_hole(t->ttyp))))) {
u.ux = x;
u.uy = y;
} else {
if (obj->otyp == BOULDER && boulder_hits_pool(obj, x, y, FALSE)) {
return TRUE;
} else if (obj->otyp == BOULDER && (t = t_at(x, y)) != 0
- && (is_pit(t->ttyp)
- || t->ttyp == TRAPDOOR || t->ttyp == HOLE)) {
+ && (is_pit(t->ttyp) || is_hole(t->ttyp))) {
if (((mtmp = m_at(x, y)) && mtmp->mtrapped)
|| (u.utrap && u.ux == x && u.uy == y)) {
if (*verb)
if (trap && uteetering_at_seen_pit(trap)) {
dotrap(trap, TOOKPLUNGE);
return 1;
- } else if (!trap || (trap->ttyp != TRAPDOOR && trap->ttyp != HOLE)
+ } else if (!trap || !is_hole(trap->ttyp)
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
if (flags.autodig && !context.nopick && uwep && is_pick(uwep)) {
return use_pick_axe2(uwep);
/* boulders never fall through trap doors, but they might knock
other things down before plugging the hole */
if (otmp->otyp == BOULDER && ((t = t_at(x, y)) != 0)
- && (t->ttyp == TRAPDOOR || t->ttyp == HOLE)) {
+ && is_hole(t->ttyp)) {
if (impact)
impact_drop(otmp, x, y, 0);
return FALSE; /* let caller finish the drop */
}
if (((ttmp = t_at(x, y)) != 0 && ttmp->tseen)
- && (ttmp->ttyp == TRAPDOOR || ttmp->ttyp == HOLE)) {
+ && is_hole(ttmp->ttyp)) {
gate_str = (ttmp->ttyp == TRAPDOOR) ? "through the trap door"
: "through the hole";
return MIGR_RANDOM;
dotrap(ttmp, 0); /* doesn't print messages */
} else if (ttmp->ttyp == FIRE_TRAP) {
dotrap(ttmp, 0);
- } else if ((is_pit(ttmp->ttyp)
- || ttmp->ttyp == HOLE || ttmp->ttyp == TRAPDOOR)
+ } else if ((is_pit(ttmp->ttyp) || is_hole(ttmp->ttyp))
&& Sokoban) {
/* air currents overcome the recoil in Sokoban;
when jumping, caller performs last step and enters trap */
if (trap_type || !rn2(4)) {
rm->typ = SCORR;
if (trap_type) {
- if ((trap_type == HOLE || trap_type == TRAPDOOR)
- && !Can_fall_thru(&u.uz))
+ if (is_hole(trap_type) && !Can_fall_thru(&u.uz))
trap_type = ROCKTRAP;
ttmp = maketrap(xx, yy + dy, trap_type);
if (ttmp) {
} while (kind == NO_TRAP);
}
- if ((kind == TRAPDOOR || kind == HOLE) && !Can_fall_thru(&u.uz))
+ if (is_hole(kind) && !Can_fall_thru(&u.uz))
kind = ROCKTRAP;
if (tm) {
m = *tm;
} else {
register int tryct = 0;
- boolean avoid_boulder = (is_pit(kind)
- || kind == TRAPDOOR || kind == HOLE);
+ boolean avoid_boulder = (is_pit(kind) || is_hole(kind));
do {
if (++tryct > 200)
if ((ttmp->ttyp != RUST_TRAP
|| mdat == &mons[PM_IRON_GOLEM])
&& ttmp->ttyp != STATUE_TRAP
- && ((!is_pit(ttmp->ttyp)
- && ttmp->ttyp != TRAPDOOR && ttmp->ttyp != HOLE)
+ && ((!is_pit(ttmp->ttyp) && !is_hole(ttmp->ttyp))
|| (!is_flyer(mdat) && !is_floater(mdat)
&& !is_clinger(mdat)) || Sokoban)
&& (ttmp->ttyp != SLP_GAS_TRAP || !resists_sleep(mon))
|| onscary(xx, yy, mtmp))
continue;
/* use trap if it's the correct type */
- if ((t->ttyp == TRAPDOOR || t->ttyp == HOLE)
+ if (is_hole(t->ttyp)
&& !is_floater(mtmp->data)
&& !mtmp->isshk && !mtmp->isgd && !mtmp->ispriest
&& Can_fall_thru(&u.uz)) {
if (strncmpi(tname, bp, strlen(tname)))
continue;
/* found it; avoid stupid mistakes */
- if ((trap == TRAPDOOR || trap == HOLE) && !Can_fall_thru(&u.uz))
+ if (is_hole(trap) && !Can_fall_thru(&u.uz))
trap = ROCKTRAP;
if ((t = maketrap(x, y, trap)) != 0) {
trap = t->ttyp;
break;
tt = trap->ttyp;
if (u.dz) {
- if (u.dz < 0 ? (tt == TRAPDOOR || tt == HOLE)
- : tt == ROCKTRAP)
+ if (u.dz < 0 ? is_hole(tt) : tt == ROCKTRAP)
break;
}
tt = what_trap(tt);
maze1xy(&mm, DRY);
trytrap = rndtrap();
if (sobj_at(BOULDER, mm.x, mm.y))
- while (is_pit(trytrap)
- || trytrap == TRAPDOOR || trytrap == HOLE)
+ while (is_pit(trytrap) || is_hole(trytrap))
trytrap = rndtrap();
(void) maketrap(mm.x, mm.y, trytrap);
}
while (ttmp) {
if ((ttmp->ttyp == MAGIC_PORTAL || ttmp->ttyp == VIBRATING_SQUARE
- || ttmp->ttyp == HOLE || ttmp->ttyp == TRAPDOOR)
+ || is_hole(ttmp->ttyp))
&& !selection_getpoint(ttmp->tx, ttmp->ty, ov))
selection_floodfill(ov, ttmp->tx, ttmp->ty, TRUE);
ttmp = ttmp->ntrap;
d_level tolevel;
int migrate_typ = MIGR_RANDOM;
- if ((tt == HOLE || tt == TRAPDOOR)) {
+ if (is_hole(tt)) {
if (Is_stronghold(&u.uz)) {
assign_level(&tolevel, &valley_level);
} else if (Is_botlevel(&u.uz)) {
case HOLE:
case TRAPDOOR:
if (*in_rooms(x, y, SHOPBASE)
- && (typ == HOLE || typ == TRAPDOOR
- || IS_DOOR(lev->typ) || IS_WALL(lev->typ)))
+ && (is_hole(typ) || IS_DOOR(lev->typ) || IS_WALL(lev->typ)))
add_damage(x, y, /* schedule repair */
((IS_DOOR(lev->typ) || IS_WALL(lev->typ))
&& !context.mon_moving)
nomul(0);
/* KMH -- You can't escape the Sokoban level traps */
- if (Sokoban && (is_pit(ttype)
- || ttype == HOLE || ttype == TRAPDOOR)) {
+ if (Sokoban && (is_pit(ttype) || is_hole(ttype))) {
/* The "air currents" message is still appropriate -- even when
* the hero isn't flying or levitating -- because it conveys the
* reason why the player cannot escape the trap with a dexterity
if (Punished && !carried(uball)
&& (is_pool(uball->ox, uball->oy)
|| ((trap = t_at(uball->ox, uball->oy))
- && (is_pit(trap->ttyp)
- || (trap->ttyp == TRAPDOOR) || (trap->ttyp == HOLE))))) {
+ && (is_pit(trap->ttyp) || is_hole(trap->ttyp))))) {
u.ux0 = u.ux;
u.uy0 = u.uy;
u.ux = uball->ox;
if (ttmp && ((ttmp->ttyp == SQKY_BOARD) || (ttmp->ttyp == BEAR_TRAP)
|| (ttmp->ttyp == LANDMINE) || (ttmp->ttyp == FIRE_TRAP)
|| is_pit(ttmp->ttyp)
- || (ttmp->ttyp == HOLE) || (ttmp->ttyp == TRAPDOOR)
+ || is_hole(ttmp->ttyp)
|| (ttmp->ttyp == TELEP_TRAP) || (ttmp->ttyp == LEVEL_TELEP)
|| (ttmp->ttyp == WEB) || (ttmp->ttyp == MAGIC_TRAP)
|| (ttmp->ttyp == ANTI_MAGIC))) {
The(distant_name(obj, xname))); /* lame */
range = 0;
} else if (Sokoban && (t = t_at(x, y)) != 0
- && (is_pit(t->ttyp)
- || t->ttyp == HOLE || t->ttyp == TRAPDOOR)) {
+ && (is_pit(t->ttyp) || is_hole(t->ttyp))) {
/* hero falls into the trap, so ball stops */
range = 0;
}