int doidtrap(void) { struct trap *trap; int x, y, tt; schar dx, dy, dz; if (!getdir(NULL, &dx, &dy, &dz)) return 0; x = u.ux + dx; y = u.uy + dy; for (trap = level->lev_traps; trap; trap = trap->ntrap) if (trap->tx == x && trap->ty == y) { if (!trap->tseen) break; tt = trap->ttyp; if (dz) { if (dz < 0 ? (tt == TRAPDOOR || tt == HOLE) : tt == ROCKTRAP) break; } tt = what_trap(tt); pline("That is %s%s%s.", an(trapexplain[tt - 1]), !trap->madeby_u ? "" : (tt == WEB) ? " woven" : /* trap doors & spiked pits can't be made by player, and should be considered at least as much "set" as "dug" anyway */ (tt == HOLE || tt == PIT) ? " dug" : " set", !trap->madeby_u ? "" : " by you"); return 0; } pline("I can't see a trap there."); return 0; }
int doidtrap (void) { struct trap *trap; int x, y, tt; if (!getdir("^")) return 0; x = u.ux + u.delta.x; y = u.uy + u.delta.y; for (trap = ftrap; trap; trap = trap->ntrap) if (trap->tx == x && trap->ty == y) { if (!trap->tseen) break; tt = trap->ttyp; if (u.delta.z) { if (u.delta.z < 0 ? (tt == TRAPDOOR || tt == HOLE) : tt == ROCKTRAP) break; } tt = what_trap(tt); pline("That is %s%s%s.", an(defsyms[trap_to_defsym(tt)].explanation), !trap->madeby_u ? "" : (tt == WEB) ? " woven" : /* trap doors & spiked pits can't be made by player, and should be considered at least as much "set" as "dug" anyway */ (tt == HOLE || tt == PIT) ? " dug" : " set", !trap->madeby_u ? "" : " by you"); return 0; } pline("I can't see a trap there."); return 0; }
int doidtrap(const struct nh_cmd_arg *arg) { struct trap *trap; int x, y, tt; schar dx, dy, dz; if (!getargdir(arg, NULL, &dx, &dy, &dz)) return 0; x = u.ux + dx; y = u.uy + dy; for (trap = level->lev_traps; trap; trap = trap->ntrap) if (trap->tx == x && trap->ty == y) { if (!trap->tseen) break; tt = trap->ttyp; if (dz) { if (dz < 0 ? (tt == TRAPDOOR || tt == HOLE) : tt == ROCKTRAP) break; } /* This command is CMD_NOTIME, pick the RNG accordingly */ tt = what_trap(tt, x, y, rn2_on_display_rng); pline("That is %s%s%s.", an(trapexplain[tt - 1]), !trap->madeby_u ? "" : (tt == WEB) ? " woven" : /* trap doors & spiked pits can't be made by player, and should be considered at least as much "set" as "dug" anyway */ (tt == HOLE || tt == PIT) ? " dug" : " set", !trap->madeby_u ? "" : " by you"); return 0; } pline("I can't see a trap there."); return 0; }