trapped box->tknown

If 'autounlock' is set to test a chest for traps, skip "check for
traps?" when tknown is set; go directly to "disarm trap?" if the
chest is trapped, skip that too if it isn't.

If wand of probing hits a chest, set the tknown bit.
This commit is contained in:
PatR
2025-03-12 01:28:05 -07:00
parent 8f84f76f09
commit 31d86a8c41
2 changed files with 12 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 zap.c $NHDT-Date: 1737344505 2025/01/19 19:41:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.562 $ */
/* NetHack 3.7 zap.c $NHDT-Date: 1741793439 2025/03/12 07:30:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.564 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2209,10 +2209,14 @@ bhito(struct obj *obj, struct obj *otmp)
obj->dknown = 1;
if (Is_container(obj) || obj->otyp == STATUE) {
obj->cknown = obj->lknown = 1;
/* plural handling here is superfluous because containers
and statues don't stack */
if (obj->otrapped)
pline("%s trapped!", Tobjnam(obj, "are"));
if (Is_box(obj) && !obj->tknown) {
/* obj->tknown applies to boxes and chests, not bags or
statues; plural handling here and the "empty" case
below are superfluous because containers don't stack */
if (obj->otrapped)
pline("%s trapped!", Tobjnam(obj, "are"));
obj->tknown = 1;
}
if (!obj->cobj) {
pline("%s empty.", Tobjnam(obj, "are"));