From: PatR Date: Tue, 31 May 2016 13:37:14 +0000 (-0700) Subject: more door/chest trap detection X-Git-Tag: NetHack-3.6.1_RC01~718 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d41e097ea85246719e816cb61ea9a86c4c996df1;p=nethack more door/chest trap detection Make the '^' command catch up with far-look as far as identifying trapped doors and trapped chests revealed by confused gold detect. You need to be blinded when approaching the '^', otherwise as soon as you can see a door or chest or whatever else is there the fake bear trap will be removed from the map. --- diff --git a/src/pager.c b/src/pager.c index 0dfbbf5a2..8ffe31409 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1227,12 +1227,24 @@ int doidtrap() { register struct trap *trap; - int x, y, tt; + int x, y, tt, glyph; if (!getdir("^")) return 0; x = u.ux + u.dx; y = u.uy + u.dy; + + /* check fake bear trap from confused gold detection */ + glyph = glyph_at(x, y); + if (glyph_is_trap(glyph) && (tt = glyph_to_trap(glyph)) == BEAR_TRAP) { + boolean chesttrap = trapped_chest_at(tt, x, y); + + if (chesttrap || trapped_door_at(tt, x, y)) { + pline("That is a trapped %s.", chesttrap ? "chest" : "door"); + return 0; /* trap ID'd, but no time elapses */ + } + } + for (trap = ftrap; trap; trap = trap->ntrap) if (trap->tx == x && trap->ty == y) { if (!trap->tseen)