MUSE wand of striking

Some code to stop a monster's zap of a wand of striking short if it
gets destroyed by hitting and destroying a drawbridge is no longer
needed with the new deferred obj deletion.
This commit is contained in:
PatR
2024-05-07 12:14:54 -07:00
parent 2ce432657c
commit c8b8f8767e

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 muse.c $NHDT-Date: 1711734229 2024/03/29 17:43:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.216 $ */
/* NetHack 3.7 muse.c $NHDT-Date: 1715109270 2024/05/07 19:14:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.218 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -1661,7 +1661,6 @@ mbhit(
struct obj *obj) /* 2nd arg to fhitm/fhito */
{
struct monst *mtmp;
struct obj *otmp;
uchar ltyp;
int ddx, ddy, otyp = obj->otyp;
@@ -1699,29 +1698,12 @@ mbhit(
if (otyp == WAN_STRIKING
/* if levl[x][y].typ is DRAWBRIDGE_UP then the zap is passing
over the moat in front of a closed drawbridge and doesn't
hit any part of the bridge's mechanism */
hit any part of the bridge's mechanism (yet; it might be
about to hit the closed portcullis on the next iteration) */
&& ltyp != DRAWBRIDGE_UP && find_drawbridge(&dbx, &dby)) {
/* this might kill mon and destroy obj; mon will remain
accessible even if dead but obj could be deleted */
/* this might kill mon and destroy obj but they'll remain
accessible; (*fhitm)() and (*fhito)() use obj for zap type */
destroy_drawbridge(dbx, dby);
for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
if (otmp == obj)
break;
if (!otmp) {
for (otmp = gl.level.objects[x][y]; otmp;
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;*/
break;
}
} else if (IS_DOOR(ltyp) || ltyp == SDOOR) {
switch (otyp) {
/* note: monsters don't use opening or locking magic