Skip to content

Commit

Permalink
discard_minvent
Browse files Browse the repository at this point in the history
     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.
  • Loading branch information
nethack.rankin committed Apr 22, 2007
1 parent 62a33d9 commit 1724067
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/mkobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}
}
Expand Down

0 comments on commit 1724067

Please sign in to comment.