more MUSE WAND_STRING (should be WAND_STRIKING)
Reverse part of commit 8b5e9eadb1.
Shouldn't use get_obj_location(obj,...) to try to figure out if obj
has been deleted. That routine uses obj->where rather than scanning
the various object lists and doing that when obj has been deleted
would access stale memory.
This commit is contained in:
21
src/muse.c
21
src/muse.c
@@ -1660,12 +1660,21 @@ mbhit(
|
|||||||
/* this might kill mon and destroy obj; mon will remain
|
/* this might kill mon and destroy obj; mon will remain
|
||||||
accessible even if dead but obj could be deleted */
|
accessible even if dead but obj could be deleted */
|
||||||
destroy_drawbridge(dbx, dby);
|
destroy_drawbridge(dbx, dby);
|
||||||
if (!get_obj_location(obj, &dbx, &dbx, /* reuse <dbx,dby> */
|
for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
|
||||||
CONTAINED_TOO | BURIED_TOO)) {
|
if (otmp == obj)
|
||||||
/* couldn't find obj, so assume that it has been destroyed
|
break;
|
||||||
and end the zap; not really correct behavior but we can't
|
if (!otmp) {
|
||||||
continue without the wand because fhitm (mbhitm) and fhito
|
for (otmp = gl.level.objects[x][y]; otmp;
|
||||||
(bhito) would want it at forthcoming spots in zap path */
|
otmp = otmp->nexthere)
|
||||||
|
if (otmp == obj)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* if otmp is Null, mon isn't carrying obj anymore and didn't
|
||||||
|
just drop it here; assume that it was destroyed and stop
|
||||||
|
the zap; not really correct behavior but we can't continue
|
||||||
|
without the responsible object because fhitm (mbhitm) and
|
||||||
|
fhito (bhito) will want it at forthcoming spots in zap path */
|
||||||
|
if (!otmp) {
|
||||||
/*obj = NULL;*/
|
/*obj = NULL;*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user