From 4df491e47d757cb04288d6d3d1afc4f0d6bb2530 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 25 Feb 2019 15:44:21 -0800 Subject: [PATCH] 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".) --- doc/fixes36.2 | 5 ++++- src/do_wear.c | 5 +++-- src/objnam.c | 9 +++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index c9b5c83cd..e9d671467 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.263 $ $NHDT-Date: 1551137618 2019/02/25 23:33:38 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.264 $ $NHDT-Date: 1551138255 2019/02/25 23:44:15 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -380,6 +380,9 @@ when using 'f' to fire/throw--and possibly some ^A's to repeat--then running was already worn or wielded) and then ask for a direction to fire it early rolling boulder trap lacking any boulder might still have the corpse of a dead adventurer +persistent inventory window would show "(being worn)" for armor that was in + the midst of being put on or taken off; it is 'partly worn' in such + circumstances so "being worn" could be misleading Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/do_wear.c b/src/do_wear.c index 793abfab5..9132e7535 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -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; diff --git a/src/objnam.c b/src/objnam.c index cfb1a3e15..af2365f55 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -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)