From: PatR Date: Wed, 25 Nov 2015 22:56:58 +0000 (-0800) Subject: trap creation sanity check X-Git-Tag: NetHack-3.6.0_RC01~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7f64606d746317303b2701ddb6852e4784bc7ea;p=nethack trap creation sanity check Noticed while testing the look-at vs vibrating square patch: I was able to cover stairs with a trap via wizard mode wish. That wish can achieve a lot of irregular things, but prevent this particular one. --- diff --git a/src/trap.c b/src/trap.c index 495525045..b8944eea9 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 trap.c $NHDT-Date: 1448094344 2015/11/21 08:25:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.248 $ */ +/* NetHack 3.6 trap.c $NHDT-Date: 1448492213 2015/11/25 22:56:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.249 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -336,6 +336,10 @@ register int x, y, typ; && typ != SPIKED_PIT))) u.utrap = 0; /* old remain valid */ + } else if (IS_FURNITURE(levl[x][y].typ)) { + /* no trap on top of furniture (caller usually screens the + location to inhibit this, but wizard mode wishing doesn't) */ + return (struct trap *) 0; } else { oldplace = FALSE; ttmp = newtrap();