]> granicus.if.org Git - nethack/commitdiff
Prevent monsters throwing items out of map
authorPasi Kallinen <paxed@alt.org>
Wed, 29 Apr 2015 13:28:01 +0000 (16:28 +0300)
committerPasi Kallinen <paxed@alt.org>
Wed, 29 Apr 2015 13:28:05 +0000 (16:28 +0300)
If a monster was in the projectile's path, the projectile stopping
checks would not be reached.  The thrown object could fly up to
the maximum range, through walls, or even outside the map.

src/mthrowu.c

index 1ff6cddc39a91ab36184c3af2d0a97fc2325edde..e8095332c0a2a34cbd181488d947e724a062b812 100644 (file)
@@ -421,7 +421,8 @@ struct obj *obj;            /* missile (or stack providing it) */
                        (void) drop_throw(singleobj, hitu, u.ux, u.uy);
                        break;
                    }
-               } else if (!range       /* reached end of path */
+               }
+               if (!range      /* reached end of path */
                        /* missile hits edge of screen */
                        || !isok(bhitpos.x+dx,bhitpos.y+dy)
                        /* missile hits the wall */
@@ -440,7 +441,7 @@ struct obj *obj;            /* missile (or stack providing it) */
                tmp_at(bhitpos.x, bhitpos.y);
                delay_output();
        }
-       if (isok(bhitpos.x, bhitpos.y)) tmp_at(bhitpos.x, bhitpos.y);
+       tmp_at(bhitpos.x, bhitpos.y);
        delay_output();
        tmp_at(DISP_END, 0);