From b8cfa9b33fe885e074183733cc83390068d4195e Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 29 Apr 2015 16:28:01 +0300 Subject: [PATCH] Prevent monsters throwing items out of map 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mthrowu.c b/src/mthrowu.c index 1ff6cddc3..e8095332c 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -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);