-/* SCCS Id: @(#)apply.c 3.5 2005/03/28 */
+/* SCCS Id: @(#)apply.c 3.5 2005/04/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
ttmp = maketrap(u.ux, u.uy, ttyp);
if (ttmp) {
- ttmp->tseen = 1;
ttmp->madeby_u = 1;
- newsym(u.ux, u.uy); /* if our hero happens to be invisible */
+ feeltrap(ttmp);
if (*in_rooms(u.ux,u.uy,SHOPBASE)) {
add_damage(u.ux, u.uy, 0L); /* schedule removal */
}
if (!trapinfo.force_bungle)
You("finish arming %s.",
- the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation));
- if (((otmp->cursed || Fumbling) && (rnl(10) > 5)) || trapinfo.force_bungle)
+ the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation));
+ if (((otmp->cursed || Fumbling) && (rnl(10) > 5)) ||
+ trapinfo.force_bungle)
dotrap(ttmp,
(unsigned)(trapinfo.force_bungle ? FORCEBUNGLE : 0));
} else {
-/* SCCS Id: @(#)dig.c 3.5 2005/03/07 */
+/* SCCS Id: @(#)dig.c 3.5 2005/04/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
ttmp = maketrap(x, y, ttyp);
if (!ttmp) return;
newobjs = level.objects[x][y];
- ttmp->tseen = (madeby_u || cansee(x,y));
ttmp->madeby_u = madeby_u;
- newsym(ttmp->tx,ttmp->ty);
+ if (cansee(x,y)) seetrap(ttmp);
+ else if (madeby_u) feeltrap(ttmp);
if (ttyp == PIT) {
-/* SCCS Id: @(#)trap.c 3.5 2005/03/16 */
+/* SCCS Id: @(#)trap.c 3.5 2005/04/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
} while(!rn2(4) && newlevel < dunlevs_in_dungeon(&u.uz));
if(td) {
- struct trap *t=t_at(u.ux,u.uy);
- seetrap(t);
+ struct trap *t = t_at(u.ux,u.uy);
+ feeltrap(t);
if (!In_sokoban(&u.uz)) {
if (t->ttyp == TRAPDOOR)
pline("A trap door opens up under you!");
int dmg = d(2,6); /* should be std ROCK dmg? */
trap->once = 1;
- seetrap(trap);
+ feeltrap(trap);
otmp = mksobj_at(ROCK, u.ux, u.uy, TRUE, FALSE);
otmp->quan = 1L;
otmp->owt = weight(otmp);
case BEAR_TRAP:
if(Levitation || Flying) break;
- seetrap(trap);
+ feeltrap(trap);
if(amorphous(youmonst.data) || is_whirly(youmonst.data) ||
unsolid(youmonst.data)) {
pline("%s bear trap closes harmlessly through you.",
case SPIKED_PIT:
/* KMH -- You can't escape the Sokoban level traps */
if (!In_sokoban(&u.uz) && (Levitation || Flying)) break;
- seetrap(trap);
+ feeltrap(trap);
if (!In_sokoban(&u.uz) && is_clinger(youmonst.data)) {
if(trap->tseen) {
You("see %s %spit below you.", a_your[trap->madeby_u],
break;
case WEB: /* Our luckless player has stumbled into a web. */
- seetrap(trap);
+ feeltrap(trap);
if (amorphous(youmonst.data) || is_whirly(youmonst.data) ||
unsolid(youmonst.data)) {
if (acidic(youmonst.data) || u.umonnum == PM_GELATINOUS_CUBE ||
}
if (webmaker(youmonst.data)) {
if (webmsgok)
- pline(trap->madeby_u ? "You take a walk on your web."
+ pline(trap->madeby_u ? "You take a walk on your web."
: "There is a spider web here.");
break;
}
#endif
if (Levitation || Flying) {
if (!already_seen && rn2(3)) break;
- seetrap(trap);
+ feeltrap(trap);
pline("%s %s in a pile of soil below you.",
already_seen ? "There is" : "You discover",
trap->madeby_u ? "the trigger of your mine" :
if (recursive_mine) break;
#endif
- seetrap(trap);
+ feeltrap(trap);
pline("KAABLAMM!!! You triggered %s land mine!",
a_your[trap->madeby_u]);
#ifdef STEED
case ROLLING_BOULDER_TRAP: {
int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0);
- seetrap(trap);
+ feeltrap(trap);
pline("Click! You trigger a rolling boulder trap!");
if(!launch_obj(BOULDER, trap->launch.x, trap->launch.y,
trap->launch2.x, trap->launch2.y, style)) {
break;
}
case MAGIC_PORTAL:
- seetrap(trap);
+ feeltrap(trap);
domagicportal(trap);
break;
default:
- seetrap(trap);
+ feeltrap(trap);
impossible("You hit a trap of type %u", trap->ttyp);
}
}
singleobj->oy = dest.dlevel;
singleobj->owornmask = (long)MIGR_RANDOM;
}
- seetrap(t);
+ seetrap(t);
used_up = TRUE;
launch_drop_spot((struct obj *)0, 0, 0);
break;
void
seetrap(trap)
- register struct trap *trap;
+struct trap *trap;
{
- if(!trap->tseen) {
- trap->tseen = 1;
- newsym(trap->tx, trap->ty);
- }
+ if (!trap->tseen) {
+ trap->tseen = 1;
+ newsym(trap->tx, trap->ty);
+ }
+}
+
+/* like seetrap() but overrides vision */
+void
+feeltrap(trap)
+struct trap *trap;
+{
+ trap->tseen = 1;
+ map_trap(trap, 1);
+ /* in case it's beneath something, redisplay the something */
+ newsym(trap->tx, trap->ty);
}
STATIC_OVL int