fix #H6960 - redundant feedback for '#force'

When using #force at a spot which has a broken or unlocked chest (or
large box) whose lock state has been previously discovered, avoid
|There is a broken chest here, but its lock is already broken.
|There is an unlocked chest here, but its lock is already unlocked.
by suppressing "broken"/"unlocked" from the chest description for
that particular message.

We might still want to change "broken chest" to "damaged chest" but
I don't think there should be any reference to its lock as the reason
it's broken or damaged.  The fact that #loot, #force, and applying a
key still treat it as a container is sufficient to reveal that it
functions as one.
This commit is contained in:
PatR
2018-03-19 15:48:46 -07:00
parent 7238803b25
commit 0419f097f1
2 changed files with 11 additions and 3 deletions

View File

@@ -527,6 +527,9 @@ fix 'object lost' panic if hero with lycanthropy but in human form is wielding
prevent segfault if pline() is called recursively (which could happen if the
interface code issues a debugpline() while processing putstr())
open at yourself is the same as #loot
when #force reports that a chest's lock is already broken or already unlocked,
force it to be described as "a chest", even when its lock state is
already known, rather than as "a broken chest" or "an unlocked chest"
Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 lock.c $NHDT-Date: 1521377334 2018/03/18 12:48:54 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.78 $ */
/* NetHack 3.6 lock.c $NHDT-Date: 1521499715 2018/03/19 22:48:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.80 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -549,8 +549,13 @@ doforce()
for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
if (Is_box(otmp)) {
if (otmp->obroken || !otmp->olocked) {
There("is %s here, but its lock is already %s.", doname(otmp),
otmp->obroken ? "broken" : "unlocked");
/* force doname() to omit known "broken" or "unlocked"
prefix so that the message isn't worded redundantly;
since we're about to set lknown, there's no need to
remember and then reset its current value */
otmp->lknown = 0;
There("is %s here, but its lock is already %s.",
doname(otmp), otmp->obroken ? "broken" : "unlocked");
otmp->lknown = 1;
continue;
}