From: Pasi Kallinen Date: Fri, 22 Apr 2016 19:47:43 +0000 (+0300) Subject: Simplify the web destruction func X-Git-Tag: NetHack-3.6.1_RC01~815 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c5aa0ff3680ea987a5530a369608eb3520c5dcda;p=nethack Simplify the web destruction func --- diff --git a/src/trap.c b/src/trap.c index acaa63862..1e7b88b4d 100644 --- a/src/trap.c +++ b/src/trap.c @@ -794,7 +794,6 @@ struct obj *objchn, *saddle; } /* monster or you go through and possibly destroy a web. - mtmp == NULL == you. return TRUE if could go through. */ boolean mu_maybe_destroy_web(mtmp, domsg, trap) @@ -802,12 +801,10 @@ struct monst *mtmp; boolean domsg; struct trap *trap; { - boolean isyou = !mtmp; - struct permonst *mptr = isyou ? youmonst.data : mtmp->data; - boolean gelcube = isyou ? (u.umonnum == PM_GELATINOUS_CUBE) - : (mptr == &mons[PM_GELATINOUS_CUBE]); + boolean isyou = (mtmp == &youmonst); + struct permonst *mptr = mtmp->data; if (amorphous(mptr) || is_whirly(mptr) || flaming(mptr) - || unsolid(mptr) || gelcube) { + || unsolid(mptr) || mptr == &mons[PM_GELATINOUS_CUBE]) { xchar x = trap->tx; xchar y = trap->ty; if (flaming(mptr) || acidic(mptr)) { @@ -1243,7 +1240,7 @@ unsigned trflags; case WEB: /* Our luckless player has stumbled into a web. */ feeltrap(trap); - if (mu_maybe_destroy_web(NULL, webmsgok, trap)) + if (mu_maybe_destroy_web(&youmonst, webmsgok, trap)) break; if (webmaker(youmonst.data)) { if (webmsgok)