diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-22 15:48:51 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-22 15:48:51 +0000 |
commit | 2843313c1bb88be3883d42f31690b7f45ad7ed62 (patch) | |
tree | 1580ab3330d65442bb2abe1393a65b19c709e2b8 | |
parent | 5dccf2d90162f1eef994c4da9dd387fcfbfc2ebe (diff) | |
download | crawl-ref-2843313c1bb88be3883d42f31690b7f45ad7ed62.tar.gz crawl-ref-2843313c1bb88be3883d42f31690b7f45ad7ed62.zip |
Search the entire level for exits, not just 2 * LOS_RADIUS.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6043 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/monstuff.cc | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index ca1f922f62..efc1e6f155 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2362,28 +2362,32 @@ static void _mark_neighbours_target_unreachable(monsters *mon) } static void _mons_find_level_exits(const monsters *mon, - std::vector<level_exit> &e, int range = -1) + std::vector<level_exit> &e) { e.clear(); - if (range == -1) - range = LOS_RADIUS * 2; - - // Sweep every square within range. - for (radius_iterator ri(mon->pos(), range, true, false); ri; ++ri) + for (int y = 0; y < GXM; ++y) { - // All types of stairs. - if (is_stair(grd(*ri))) - e.push_back(level_exit(*ri, MTRAV_STAIR)); + for (int x = 0; x < GXM; ++x) + { + if (in_bounds(x, y)) + { + dungeon_feature_type gridc = grd[x][y]; - // Shaft traps. - trap_type tt = trap_type_at_xy(ri->x, ri->y); - if (tt == TRAP_SHAFT && _is_trap_safe(mon, ri->x, ri->y)) - e.push_back(level_exit(*ri, MTRAV_TRAP)); + // All types of stairs. + if (is_stair(gridc)) + e.push_back(level_exit(coord_def(x, y), MTRAV_STAIR)); - // Any place the monster can submerge. - if (monster_can_submerge(mon, grd(*ri))) - e.push_back(level_exit(*ri, MTRAV_SUBMERSIBLE)); + // Shaft traps. + trap_type tt = trap_type_at_xy(x, y); + if (tt == TRAP_SHAFT && _is_trap_safe(mon, x, y)) + e.push_back(level_exit(coord_def(x, y), MTRAV_TRAP)); + + // Any place the monster can submerge. + if (monster_can_submerge(mon, gridc)) + e.push_back(level_exit(coord_def(x, y), MTRAV_SUBMERSIBLE)); + } + } } } |