more wielded/quivered iron ball
There was at least one more special case aside from throwing (jetisoning items to reduce weight after falling in water) which have needed the same extra code. This is a more general fix.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -1844,7 +1844,7 @@ E long FDECL(somegold, (long));
|
||||
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 *));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -167,13 +167,8 @@ int shotlimit;
|
||||
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);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -2350,7 +2350,7 @@ const char *str;
|
||||
/* obj == uarmh */
|
||||
hairbuf);
|
||||
}
|
||||
remove_worn_item(obj);
|
||||
remove_worn_item(obj, TRUE);
|
||||
}
|
||||
#endif /* SEDUCE */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -103,8 +103,10 @@ long amount;
|
||||
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;
|
||||
|
||||
31
src/steal.c
31
src/steal.c
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -172,8 +172,9 @@ botm: stealoid = 0;
|
||||
/* 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();
|
||||
@@ -198,19 +199,21 @@ struct obj *obj;
|
||||
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)
|
||||
@@ -333,19 +336,19 @@ gotobj:
|
||||
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;
|
||||
@@ -370,7 +373,7 @@ gotobj:
|
||||
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){
|
||||
/*
|
||||
@@ -391,7 +394,7 @@ gotobj:
|
||||
}
|
||||
}
|
||||
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));
|
||||
@@ -487,7 +490,7 @@ struct monst *mtmp;
|
||||
|
||||
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 */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -2524,7 +2524,7 @@ boolean *lostsome;
|
||||
#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--;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -1343,7 +1343,7 @@ poly_obj(obj, id)
|
||||
/* 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
|
||||
@@ -1351,7 +1351,7 @@ poly_obj(obj, id)
|
||||
* 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;
|
||||
|
||||
Reference in New Issue
Block a user