summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/output.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-21 20:46:15 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-21 20:46:15 +0000
commitab9bd52586015758713a23e157666692abae7036 (patch)
treed8b9f3163aaccb629a20080ba4df658bb49eb087 /crawl-ref/source/output.cc
parent2ba0c7b650e80810a78c8a3b2c943c8f730e571b (diff)
downloadcrawl-ref-ab9bd52586015758713a23e157666692abae7036.tar.gz
crawl-ref-ab9bd52586015758713a23e157666692abae7036.zip
Clean up _get_visible_monsters().
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6629 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/output.cc')
-rw-r--r--crawl-ref/source/output.cc34
1 files changed, 12 insertions, 22 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 9190fd7529..0c7e129b14 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1073,33 +1073,23 @@ static bool _compare_monsters_attitude( const monsters *m1, const monsters *m2 )
static void _get_visible_monsters(std::vector<std::string>& describe)
{
- int ystart = you.y_pos - 9, xstart = you.x_pos - 9;
- int yend = you.y_pos + 9, xend = you.x_pos + 9;
- if ( xstart < 0 ) xstart = 0;
- if ( ystart < 0 ) ystart = 0;
- if ( xend >= GXM ) xend = GXM - 1;
- if ( yend >= GYM ) yend = GYM - 1;
-
std::vector<const monsters*> mons;
// monster check
- for (int y = ystart; y <= yend; ++y)
- for (int x = xstart; x <= xend; ++x)
- if (see_grid(x,y))
+ for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri )
+ {
+ if ( mgrd(*ri) != NON_MONSTER )
+ {
+ const monsters *mon = &menv[mgrd(*ri)];
+ if (player_monster_visible(mon)
+ && !mons_is_submerged(mon)
+ && (!mons_is_mimic(mon->type)
+ || testbits(mon->flags, MF_KNOWN_MIMIC)))
{
- const unsigned short targ_monst = mgrd[x][y];
- if (targ_monst != NON_MONSTER)
- {
- const monsters *mon = &menv[targ_monst];
- if (player_monster_visible(mon)
- && !mons_is_submerged(mon)
- && (!mons_is_mimic(mon->type)
- || testbits(mon->flags, MF_KNOWN_MIMIC)))
- {
- mons.push_back(mon);
- }
- }
+ mons.push_back(mon);
}
+ }
+ }
if (mons.empty())
return;