R888 - panic while quaffing a potion of levitation

Now that the in_use flag is set for potions being quaffed, use the in_use
flag in general in destroy_item to avoid destroying the in use object, on
the assumption that the caller will call useup when finished.  There are a
few places that set then unset in_use, but these don't currently result in
a call to destroy_item.  The current_wand hack was not removed, since its
logic appears to allow destroy_item to still destroy the item.
This commit is contained in:
cohrs
2002-07-13 23:06:22 +00:00
parent 05e993d48e
commit 1238854154
2 changed files with 4 additions and 0 deletions

View File

@@ -3758,6 +3758,7 @@ register int osym, dmgtyp;
obj2 = obj->nobj;
if(obj->oclass != osym) continue; /* test only objs of type osym */
if(obj->oartifact) continue; /* don't destroy artifacts */
if(obj->in_use && obj->quan == 1) continue; /* not available */
xresist = skip = 0;
#ifdef GCC_WARN
dmg = dindx = 0;
@@ -3829,6 +3830,7 @@ register int osym, dmgtyp;
break;
}
if(!skip) {
if (obj->in_use) --quan; /* one will be used up elsewhere */
for(i = cnt = 0L; i < quan; i++)
if(!rn2(3)) cnt++;