-/* NetHack 3.6 do_wear.c $NHDT-Date: 1496547229 2017/06/04 03:33:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.96 $ */
+/* NetHack 3.6 do_wear.c $NHDT-Date: 1496614914 2017/06/04 22:21:54 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.97 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
}
/* check whether the target object is currently being put on (or taken off--
- also checks for doffing) */
+ also checks for doffing--[why?]) */
boolean
donning(otmp)
struct obj *otmp;
{
- /* long what = (occupation == take_off) ? context.takeoff.what : 0L; */
- long what = context.takeoff.what; /* if nonzero, occupation is implied */
boolean result = FALSE;
/* 'W' and 'T' set afternmv, 'A' sets context.takeoff.what */
- if (otmp == uarm)
- result = (afternmv == Armor_on || afternmv == Armor_off
- || what == WORN_ARMOR);
+ if (doffing(otmp))
+ result = TRUE;
+ else if (otmp == uarm)
+ result = (afternmv == Armor_on);
else if (otmp == uarmu)
- result = (afternmv == Shirt_on || afternmv == Shirt_off
- || what == WORN_SHIRT);
+ result = (afternmv == Shirt_on);
else if (otmp == uarmc)
- result = (afternmv == Cloak_on || afternmv == Cloak_off
- || what == WORN_CLOAK);
+ result = (afternmv == Cloak_on);
else if (otmp == uarmf)
- result = (afternmv == Boots_on || afternmv == Boots_off
- || what == WORN_BOOTS);
+ result = (afternmv == Boots_on);
else if (otmp == uarmh)
- result = (afternmv == Helmet_on || afternmv == Helmet_off
- || what == WORN_HELMET);
+ result = (afternmv == Helmet_on);
else if (otmp == uarmg)
- result = (afternmv == Gloves_on || afternmv == Gloves_off
- || what == WORN_GLOVES);
+ result = (afternmv == Gloves_on);
else if (otmp == uarms)
- result = (afternmv == Shield_on || afternmv == Shield_off
- || what == WORN_SHIELD);
- /* these 1-turn items don't need 'afternmv' checks
- [and may not actually need 'what' checks] */
- else if (otmp == uamul)
- result = (what == WORN_AMUL);
- else if (otmp == uleft)
- result = (what == LEFT_RING);
- else if (otmp == uright)
- result = (what == RIGHT_RING);
- else if (otmp == ublindf)
- result = (what == WORN_BLINDF);
- else if (otmp == uwep)
- result = (what == W_WEP);
- else if (otmp == uswapwep)
- result = (what == W_SWAPWEP);
- else if (otmp == uquiver)
- result = (what == W_QUIVER);
+ result = (afternmv == Shield_on);
return result;
}
-/* 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. */
/* 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)
-/* NetHack 3.6 wield.c $NHDT-Date: 1461967849 2016/04/29 22:10:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.49 $ */
+/* NetHack 3.6 wield.c $NHDT-Date: 1496614915 2017/06/04 22:21:55 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.53 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
pline("%s shining.", Tobjnam(uwep, "stop"));
}
setworn((struct obj *) 0, W_WEP);
+ /* update takeoff mask in case uwep has just gone away while
+ its removal via 'A' was pending, similar to what the various
+ Xyzzy_off(do_wear.c) routines do for armor and accessories */
+ context.takeoff.mask &= ~W_WEP;
unweapon = TRUE;
update_inventory();
}
{
if (uswapwep) {
setworn((struct obj *) 0, W_SWAPWEP);
+ context.takeoff.mask &= ~W_SWAPWEP;
update_inventory();
}
}
{
if (uquiver) {
setworn((struct obj *) 0, W_QUIVER);
+ context.takeoff.mask &= ~W_QUIVER;
update_inventory();
}
}