discard_minvent

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.
This commit is contained in:
nethack.rankin
2007-04-22 02:38:47 +00:00
parent 62a33d981a
commit 1724067660

View File

@@ -1565,10 +1565,20 @@ void
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 */
}
}