-/* SCCS Id: @(#)extern.h 3.4 2002/03/09 */
+/* SCCS Id: @(#)extern.h 3.4 2002/03/29 */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
E long NDECL(somegold);
#endif
E void FDECL(stealgold, (struct monst *));
-E void FDECL(remove_worn_item, (struct obj *));
+E void FDECL(remove_worn_item, (struct obj *,BOOLEAN_P));
E int FDECL(steal, (struct monst *, char *));
E int FDECL(mpickobj, (struct monst *,struct obj *));
E void FDECL(stealamulet, (struct monst *));
-/* SCCS Id: @(#)dothrow.c 3.4 2002/02/21 */
+/* SCCS Id: @(#)dothrow.c 3.4 2002/03/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
otmp = splitobj(obj, 1L);
} else {
otmp = obj;
- if (otmp->owornmask && otmp != uball)
- remove_worn_item(otmp);
- else if ((obj->owornmask & (W_WEP|W_SWAPWEP|W_QUIVER)) != 0) {
- /* wielded ball, special case */
- setworn((struct obj *)0,
- (obj->owornmask & (W_WEP|W_SWAPWEP|W_QUIVER)));
- }
+ if (otmp->owornmask)
+ remove_worn_item(otmp, FALSE);
}
freeinv(otmp);
throwit(otmp, wep_mask, twoweap);
-/* SCCS Id: @(#)mhitu.c 3.4 2002/02/17 */
+/* SCCS Id: @(#)mhitu.c 3.4 2002/03/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* obj == uarmh */
hairbuf);
}
- remove_worn_item(obj);
+ remove_worn_item(obj, TRUE);
}
#endif /* SEDUCE */
-/* SCCS Id: @(#)shk.c 3.4 2002/01/19 */
+/* SCCS Id: @(#)shk.c 3.4 2002/03/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
return 0L;
}
- if (ygold->quan > amount) ygold = splitobj(ygold, amount);
- else if (ygold->owornmask) remove_worn_item(ygold); /* quiver */
+ if (ygold->quan > amount)
+ ygold = splitobj(ygold, amount);
+ else if (ygold->owornmask)
+ remove_worn_item(ygold, FALSE); /* quiver */
freeinv(ygold);
add_to_minv(mon, ygold);
flags.botl = 1;
-/* SCCS Id: @(#)steal.c 3.4 2002/01/04 */
+/* SCCS Id: @(#)steal.c 3.4 2002/03/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* An object you're wearing has been taken off by a monster (theft or
seduction). Also used if a worn item gets transformed (stone to flesh). */
void
-remove_worn_item(obj)
+remove_worn_item(obj, unchain_ball)
struct obj *obj;
+boolean unchain_ball; /* whether to unpunish or just unwield */
{
if (donning(obj))
cancel_don();
Ring_gone(obj);
} else if (obj->owornmask & W_TOOL) {
Blindf_off(obj);
- } else if (obj->owornmask & (W_BALL|W_CHAIN)) {
- unpunish();
} else if (obj->owornmask & (W_WEP|W_SWAPWEP|W_QUIVER)) {
if (obj == uwep)
uwepgone();
- else if (obj == uswapwep)
+ if (obj == uswapwep)
uswapwepgone();
- else if (obj == uquiver)
+ if (obj == uquiver)
uqwepgone();
}
- /* catchall */
- if (obj->owornmask) setnotworn(obj);
+ if (obj->owornmask & (W_BALL|W_CHAIN)) {
+ if (unchain_ball) unpunish();
+ } else if (obj->owornmask) {
+ /* catchall */
+ setnotworn(obj);
+ }
}
/* Returns 1 when something was stolen (or at least, when N should flee now)
case AMULET_CLASS:
case RING_CLASS:
case FOOD_CLASS: /* meat ring */
- remove_worn_item(otmp);
+ remove_worn_item(otmp, TRUE);
break;
case ARMOR_CLASS:
armordelay = objects[otmp->otyp].oc_delay;
/* Stop putting on armor which has been stolen. */
if (donning(otmp)) {
- remove_worn_item(otmp);
+ remove_worn_item(otmp, TRUE);
break;
} else if (monkey_business) {
/* animals usually don't have enough patience
to take off items which require extra time */
if (armordelay >= 1 && rn2(10)) goto cant_take;
- remove_worn_item(otmp);
+ remove_worn_item(otmp, TRUE);
break;
} else {
int curssv = otmp->cursed;
named++;
/* the following is to set multi for later on */
nomul(-armordelay);
- remove_worn_item(otmp);
+ remove_worn_item(otmp, TRUE);
otmp->cursed = curssv;
if(multi < 0){
/*
}
}
else if (otmp->owornmask)
- remove_worn_item(otmp);
+ remove_worn_item(otmp, TRUE);
/* do this before removing it from inventory */
if (objnambuf) Strcpy(objnambuf, yname(otmp));
if (otmp) { /* we have something to snatch */
if (otmp->owornmask)
- remove_worn_item(otmp);
+ remove_worn_item(otmp, TRUE);
freeinv(otmp);
/* mpickobj wont merge otmp because none of the above things
to steal are mergable */
-/* SCCS Id: @(#)trap.c 3.4 2001/09/06 */
+/* SCCS Id: @(#)trap.c 3.4 20021/03/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#else
if (!otmp) return (FALSE); /* nothing to drop! */
#endif
- if (otmp->owornmask && otmp != uball) remove_worn_item(otmp);
+ if (otmp->owornmask) remove_worn_item(otmp, FALSE);
*lostsome = TRUE;
dropx(otmp);
invc--;
-/* SCCS Id: @(#)zap.c 3.4 2002/02/07 */
+/* SCCS Id: @(#)zap.c 3.4 2002/03/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* for now, take off worn items being polymorphed */
if (obj_location == OBJ_INVENT) {
if (id == STRANGE_OBJECT)
- remove_worn_item(obj);
+ remove_worn_item(obj, TRUE);
else {
/* This is called only for stone to flesh. It's a lot simpler
* than it otherwise might be. We don't need to check for
* any) and only three worn masks are possible.
*/
otmp->owornmask = obj->owornmask;
- remove_worn_item(obj);
+ remove_worn_item(obj, TRUE);
setworn(otmp, otmp->owornmask);
if (otmp->owornmask & LEFT_RING)
uleft = otmp;