Genociding * to clear a level in wizard mode, or paying off a
shopkeeper to dismiss kops in any mode, could trigger the recently added
warning about deleting worn items in obfree(). mongone -> discard_minvent
wasn't bothering to unwear/unwield monster gear before deletion.
discard_minvent(mtmp)
struct monst *mtmp;
{
- struct obj *otmp;
+ struct obj *otmp, *mwep = MON_WEP(mtmp);
+ boolean keeping_mon = (mtmp->mhp > 0);
while ((otmp = mtmp->minvent) != 0) {
+ /* this has now become very similar to m_useupall()... */
obj_extract_self(otmp);
+ if (otmp->owornmask) {
+ if (keeping_mon) {
+ if (otmp == mwep) mwepgone(mtmp), mwep = 0;
+ mtmp->misc_worn_check &= ~otmp->owornmask;
+ update_mon_intrinsics(mtmp, otmp, FALSE, TRUE);
+ }
+ otmp->owornmask = 0L; /* obfree() expects this */
+ }
obfree(otmp, (struct obj *)0); /* dealloc_obj() isn't sufficient */
}
}