From: nethack.rankin Date: Thu, 14 Apr 2005 03:26:56 +0000 (+0000) Subject: finding traps while blind X-Git-Tag: MOVE2GIT~1287 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61dda66355fce81c36ffafb88640a7d51d2e121e;p=nethack finding traps while blind reported that when levitating and blind, he was getting "You float over the hole" without it showing up on the map. Easiest way to reproduce: zap a wand of digging downwards while levitating blind, move off the spot and back over it. Make sure that all traps created by the player are mapped. For other traps, it was about 50:50 whether the trap triggering message yields enough information to warrant forcibly mapping the trap when blind. --- diff --git a/include/extern.h b/include/extern.h index b41f0f2e5..0b6c47a1a 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2092,6 +2092,7 @@ E struct monst *FDECL(activate_statue_trap, (struct trap *,XCHAR_P,XCHAR_P,BOOLEAN_P)); E void FDECL(dotrap, (struct trap *, unsigned)); E void FDECL(seetrap, (struct trap *)); +E void FDECL(feeltrap, (struct trap *)); E int FDECL(mintrap, (struct monst *)); E void FDECL(instapetrify, (const char *)); E void FDECL(minstapetrify, (struct monst *,BOOLEAN_P)); diff --git a/src/apply.c b/src/apply.c index f93e487b0..e8383d151 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1,4 +1,4 @@ -/* 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. */ @@ -2209,16 +2209,16 @@ set_trap() 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 { diff --git a/src/dig.c b/src/dig.c index 0608d0998..7c47e7695 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1,4 +1,4 @@ -/* 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. */ @@ -531,9 +531,9 @@ int ttyp; 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) { diff --git a/src/polyself.c b/src/polyself.c index 18432a356..58c171c4e 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)polyself.c 3.5 2004/11/11 */ +/* SCCS Id: @(#)polyself.c 3.5 2005/04/13 */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -919,10 +919,9 @@ dospinweb() } ttmp = maketrap(u.ux, u.uy, WEB); if (ttmp) { - ttmp->tseen = 1; ttmp->madeby_u = 1; + feeltrap(ttmp); } - newsym(u.ux, u.uy); return(1); } diff --git a/src/trap.c b/src/trap.c index b29395ff3..b20eb33cf 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* 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. */ @@ -321,8 +321,8 @@ boolean td; /* td == TRUE : trap door or hole */ } 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!"); @@ -737,7 +737,7 @@ unsigned trflags; 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); @@ -783,7 +783,7 @@ unsigned trflags; 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.", @@ -901,7 +901,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst); 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], @@ -1003,7 +1003,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst); 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 || @@ -1022,7 +1022,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst); } 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; } @@ -1154,7 +1154,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst); #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" : @@ -1175,7 +1175,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst); if (recursive_mine) break; #endif - seetrap(trap); + feeltrap(trap); pline("KAABLAMM!!! You triggered %s land mine!", a_your[trap->madeby_u]); #ifdef STEED @@ -1204,7 +1204,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst); 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)) { @@ -1215,12 +1215,12 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst); 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); } } @@ -1562,7 +1562,7 @@ int style; 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; @@ -1641,12 +1641,23 @@ int style; 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