From a7f64606d746317303b2701ddb6852e4784bc7ea Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 25 Nov 2015 14:56:58 -0800 Subject: [PATCH] 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. --- src/trap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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();