From 0419f097f12171b04b6666b0cef7dc217a46c711 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 19 Mar 2018 15:48:46 -0700 Subject: [PATCH] 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. --- doc/fixes36.1 | 3 +++ src/lock.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 73c66e65d..5fb21cb77 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -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 diff --git a/src/lock.c b/src/lock.c index 996784ca7..9de1e29c5 100644 --- a/src/lock.c +++ b/src/lock.c @@ -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; } -- 2.40.0