diff options
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r-- | crawl-ref/source/monstuff.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index f5e832f4ba..e47b0915e9 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1145,10 +1145,13 @@ bool swap_places(struct monsters *monster) int loc_x = you.x_pos; int loc_y = you.y_pos; - swap = habitat_okay( monster, grd[loc_x][loc_y] ); + const int mgrid = grd[monster->x][monster->y]; + + swap = habitat_okay( monster, grd[loc_x][loc_y] ) + && !is_grid_dangerous(mgrid); // chose an appropiate habitat square at random around the target. - if (!swap) + if (!swap && !is_grid_dangerous(mgrid)) { int num_found = 0; int temp_x, temp_y; |