]> granicus.if.org Git - nethack/commitdiff
Simplify the web destruction func
authorPasi Kallinen <paxed@alt.org>
Fri, 22 Apr 2016 19:47:43 +0000 (22:47 +0300)
committerPasi Kallinen <paxed@alt.org>
Fri, 22 Apr 2016 19:47:43 +0000 (22:47 +0300)
src/trap.c

index acaa63862d1d0d483f5fd0d3c3b218ebcfecb9d1..1e7b88b4d551d54912bb7e1a6642972c336110bb 100644 (file)
@@ -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)