more wearing armor vs perm_invent window

Realized while fixing #H8271:  if persistent inventory got an update
while wearing or taking off was in progress (not within user's control
since hero is busy) the item in question was flagged as "(being worn)"
even though it wouldn't be worn if putting on got interrupted.  Update
doname() to show "(being donned)" or "(being doffed)" instead of
"(being worn)" when corresponding operation is in progress. (During
testing, I was able to observe "being doffed" but never managed to see
"being donned".)
This commit is contained in:
PatR
2019-02-25 15:44:21 -08:00
parent 2b2106743e
commit 4df491e47d
3 changed files with 14 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_wear.c $NHDT-Date: 1550014802 2019/02/12 23:40:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.107 $ */
/* NetHack 3.6 do_wear.c $NHDT-Date: 1551138255 2019/02/25 23:44:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.108 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1231,7 +1231,8 @@ struct obj *otmp;
}
/* check whether the target object is currently being taken off,
so that stop_donning() and steal() can vary messages */
so that stop_donning() and steal() can vary messages and doname()
can vary "(being worn)" suffix */
boolean
doffing(otmp)
struct obj *otmp;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1548695445 2019/01/28 17:10:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.234 $ */
/* NetHack 3.6 objnam.c $NHDT-Date: 1551138256 2019/02/25 23:44:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.235 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1034,7 +1034,12 @@ unsigned doname_flags;
case ARMOR_CLASS:
if (obj->owornmask & W_ARMOR)
Strcat(bp, (obj == uskin) ? " (embedded in your skin)"
: " (being worn)");
/* in case of perm_invent update while Wear/Takeoff
is in progress; check doffing() before donning()
because donning() returns True for both cases */
: doffing(obj) ? " (being doffed)"
: donning(obj) ? " (being donned)"
: " (being worn)");
/*FALLTHRU*/
case WEAPON_CLASS:
if (ispoisoned)