diff options
-rw-r--r-- | crawl-ref/source/los.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index e67c364156..408d5e9ff0 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -737,6 +737,8 @@ int num_feats_between(const coord_def& source, const coord_def& target, int count = 0; int max_dist = grid_distance(source, target); + ASSERT(map_bounds(source) && map_bounds(target)); + if (source == target) return (0); // XXX: might want to count the cell. diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 9f29fbe8db..64e6276e68 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2499,8 +2499,9 @@ bool random_near_space(const coord_def& origin, coord_def& target, int min_walls_between = 0; // Skip ray tracing if possible. - if (trans_wall_block) + if (trans_wall_block && !crawl_state.arena) { + // XXX: you.pos() is invalid in the arena. min_walls_between = num_feats_between(origin, you.pos(), DNGN_CLEAR_ROCK_WALL, DNGN_CLEAR_PERMAROCK_WALL); @@ -2578,7 +2579,9 @@ bool random_near_space(const coord_def& origin, coord_def& target, if (origin_is_player) continue; - int walls_between = num_feats_between(target, you.pos(), + int walls_between = 0; + if (!crawl_state.arena) + walls_between = num_feats_between(target, you.pos(), DNGN_CLEAR_ROCK_WALL, DNGN_CLEAR_PERMAROCK_WALL); |