Just in case, so we don't leave objects or monsters inaccessible
by accident.
{
if (obj->where != OBJ_FREE)
panic("dealloc_obj: obj not free");
+ if (obj->nobj)
+ panic("dealloc_obj with nobj");
+ if (obj->cobj)
+ panic("dealloc_obj with cobj");
/* free up any timers attached to the object */
if (obj->timed)
freetmp = *mtmp;
if (freetmp->mhp <= 0 && !freetmp->isgd) {
*mtmp = freetmp->nmon;
+ freetmp->nmon = NULL;
dealloc_monst(freetmp);
count++;
} else
dealloc_monst(mon)
struct monst *mon;
{
+ if (mon->nmon)
+ panic("dealloc_monst with nmon");
if (mon->mextra)
dealloc_mextra(mon->mextra);
free((genericptr_t) mon);
context.spbook.book = (struct obj *) 0;
}
otmp->where = OBJ_FREE; /* set to free so dealloc will work */
+ otmp->nobj = NULL; /* nobj saved into otmp2 */
+ otmp->cobj = NULL; /* contents handled above */
otmp->timed = 0; /* not timed any more */
otmp->lamplit = 0; /* caller handled lights */
dealloc_obj(otmp);
context.polearm.m_id = mtmp->m_id;
context.polearm.hitmon = NULL;
}
+ mtmp->nmon = NULL; /* nmon saved into mtmp2 */
dealloc_monst(mtmp);
}
mtmp = mtmp2;