'A' again - avoid stale takeoff.mask

The do_wear.c part just eliminates some redundant code but shouldn't
produce any change in behavior.

The steal.c part should fix problems with 'A' when outer items are
taken off during theft in order to steal an inner item, where the
outer item is next to be removed (call to cancel_don() wasn't being
made).  The wield.c part matches the X_off() behavior and is needed
to handle a weapon item that's slated for removal but isn't next (so
wouldn't pass the donning()/doffing() test to trigger cancel_don()).

If this seems a lot like trial and error, it is....
This commit is contained in:
PatR
2017-06-04 15:22:00 -07:00
parent 50e5047855
commit 3046b1d7ec
3 changed files with 27 additions and 43 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 steal.c $NHDT-Date: 1456618998 2016/02/28 00:23:18 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.67 $ */
/* NetHack 3.6 steal.c $NHDT-Date: 1496614914 2017/06/04 22:21:54 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.69 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -560,18 +560,19 @@ struct monst *mtmp;
/* take off outer gear if we're targetting [hypothetical]
quest artifact suit, shirt, gloves, or rings */
if ((otmp == uarm || otmp == uarmu) && uarmc)
(void) Cloak_off();
remove_worn_item(uarmc, FALSE);
if (otmp == uarmu && uarm)
(void) Armor_off();
remove_worn_item(uarm, FALSE);
if ((otmp == uarmg || ((otmp == uright || otmp == uleft) && uarmg))
&& uwep) {
/* gloves are about to be unworn; unwield weapon(s) first */
if (u.twoweap)
uswapwepgone(); /* will clear u.twoweap */
uwepgone();
if (u.twoweap) /* remove_worn_item(uswapwep) indirectly */
remove_worn_item(uswapwep, FALSE); /* clears u.twoweap */
remove_worn_item(uwep, FALSE);
}
if ((otmp == uright || otmp == uleft) && uarmg)
(void) Gloves_off(); /* handles wielded cockatrice corpse */
/* calls Gloves_off() to handle wielded cockatrice corpse */
remove_worn_item(uarmg, FALSE);
/* finally, steal the target item */
if (otmp->owornmask)