]> granicus.if.org Git - nethack/commitdiff
cursed daggers thrown by monsters can go thru closed doors
authorcohrs <cohrs>
Wed, 3 Jul 2002 06:35:35 +0000 (06:35 +0000)
committercohrs <cohrs>
Wed, 3 Jul 2002 06:35:35 +0000 (06:35 +0000)
based on a bugfix forwarded by <Someone>, check for closed doors and drop
the missle before it.  I re-arranged the pre checks a bit so m_throw no
longer needs to trust the caller to ensure everything is OK beforehand.

doc/fixes34.1
src/mthrowu.c

index 77675a15e6ac583faecc140cb75c57dc8e8dfc61..147e4ceb3320b9057615a08b4738fae1d3eb0432 100644 (file)
@@ -136,6 +136,7 @@ monsters that are frozen or sleeping cannot be grateful for untrapping
 grammar of blessed-detection eating warning messages when eating 1 of N objects
 message for charging for items lost in a cursed magic bag wasn't always shown
 dropping gold on an altar printed no message and didn't change gnostic conduct
+don't allow cursed daggers thrown by monsters to go thru closed doors
 
 
 Platform- and/or Interface-Specific Fixes
index b4e2aec757370034c6d7dd2f0e17c7ae52ed9d34..896a6d899d807d26650063b8db85ec6211d730b2 100644 (file)
@@ -302,21 +302,21 @@ m_throw(mon, x, y, dx, dy, range, obj)
            }
            dx = rn2(3)-1;
            dy = rn2(3)-1;
-           /* pre-check validity of new direction */
-           if((!dx && !dy)
-              || !isok(bhitpos.x+dx,bhitpos.y+dy)
-              /* missile hits the wall */
-              || IS_ROCK(levl[bhitpos.x+dx][bhitpos.y+dy].typ)) {
+           /* check validity of new direction */
+           if (!dx && !dy) {
                (void) drop_throw(singleobj, 0, bhitpos.x, bhitpos.y);
                return;
            }
        }
 
-       /* also need to pre-check for bars regardless of direction,
-          but we know that isok() has already been verified;
+       /* pre-check for doors, walls and boundaries.
+          Also need to pre-check for bars regardless of direction;
           the random chance for small objects hitting bars is
           skipped when reaching them at point blank range */
-       if ((levl[bhitpos.x + dx][bhitpos.y + dy].typ == IRONBARS &&
+       if (!isok(bhitpos.x+dx,bhitpos.y+dy)
+           || IS_ROCK(levl[bhitpos.x+dx][bhitpos.y+dy].typ)
+           || closed_door(bhitpos.x+dx, bhitpos.y+dy)
+           || (levl[bhitpos.x + dx][bhitpos.y + dy].typ == IRONBARS &&
                hits_bars(&singleobj, bhitpos.x, bhitpos.y, 0, 0))) {
            (void) drop_throw(singleobj, 0, bhitpos.x, bhitpos.y);
            return;
@@ -447,6 +447,8 @@ m_throw(mon, x, y, dx, dy, range, obj)
                        || !isok(bhitpos.x+dx,bhitpos.y+dy)
                        /* missile hits the wall */
                        || IS_ROCK(levl[bhitpos.x+dx][bhitpos.y+dy].typ)
+                       /* missile hit closed door */
+                       || closed_door(bhitpos.x+dx, bhitpos.y+dy)
                        /* missile might hit iron bars */
                        || (levl[bhitpos.x+dx][bhitpos.y+dy].typ == IRONBARS &&
                        hits_bars(&singleobj, bhitpos.x, bhitpos.y, !rn2(2), 0))