summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-18 08:01:53 +0000
committerpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-18 08:01:53 +0000
commit70eeeeec718a95bee1845c48545577551b2abbb7 (patch)
treec9e985af00e933ea0531e3cf75f293a18d55339e /crawl-ref/source/misc.cc
parent51211c2806b3953a2cbb2a072ac7b5c4ebb4b8c2 (diff)
downloadcrawl-ref-70eeeeec718a95bee1845c48545577551b2abbb7.tar.gz
crawl-ref-70eeeeec718a95bee1845c48545577551b2abbb7.zip
A lot of these changes are ASCII only because I can't test in tile;
please review and see if you want to un-ifdef TILE any of it. - Status lights are squished together - Remove one HUD line, so status lights only get two lines (ASCII only). - Make HUD a little bit wider, so more status lights fit (ASCII only). Add msg_max_height option; undocumented and only used internally (for now). - Refactor colour bars a little bit: - Update when resting (ASCII only) - Show recent increase as well as recent loss (ASCII only) - Color change for recent increase/loss goes away after a few turns (currently 4) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4324 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc47
1 files changed, 28 insertions, 19 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index ea731f0344..0c21d3394c 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -2557,10 +2557,19 @@ bool mons_is_safe(const struct monsters *mon, bool want_move)
return is_safe;
}
-// Return all monsters in LOS that the player is able to see
+// Return all monsters in range (default: LOS) that the player is able to see
// and recognize as being a monster.
-void get_playervisible_monsters(std::vector<monsters*> &mons, bool want_move,
- bool just_check, bool dangerous, int range)
+//
+// want_move (??) Somehow affects what monsters are considered dangerous
+// just_check Return zero or one monsters only
+// dangerous_only Return only "dangerous" monsters
+// range search radius (defaults: LOS)
+//
+void get_playervisible_monsters(std::vector<monsters*> &mons,
+ bool want_move,
+ bool just_check,
+ bool dangerous_only,
+ int range)
{
if (range == -1)
range = LOS_RADIUS;
@@ -2572,30 +2581,30 @@ void get_playervisible_monsters(std::vector<monsters*> &mons, bool want_move,
// monster check
for ( int y = ystart; y < yend; ++y )
- for ( int x = xstart; x < xend; ++x )
+ for ( int x = xstart; x < xend; ++x )
+ {
+ const unsigned short targ_monst = env.mgrid[x][y];
+ if ( targ_monst != NON_MONSTER )
{
- const unsigned short targ_monst = env.mgrid[x][y];
- if ( targ_monst != NON_MONSTER )
+ if ( see_grid(x,y) )
{
- if ( see_grid(x,y) )
+ monsters *mon = &env.mons[targ_monst];
+ if ( player_monster_visible(mon)
+ && !mons_is_submerged(mon)
+ && (!mons_is_mimic(mon->type)
+ || mons_is_known_mimic(mon))
+ && (!dangerous_only || !mons_is_safe(mon, want_move)))
{
- monsters *mon = &env.mons[targ_monst];
- if ( player_monster_visible(mon)
- && !mons_is_submerged(mon)
- && (!mons_is_mimic(mon->type)
- || mons_is_known_mimic(mon))
- && (!dangerous || !mons_is_safe(mon, want_move)))
+ mons.push_back(mon);
+ if (just_check)
{
- mons.push_back(mon);
- if (just_check)
- {
- // one monster found, that's enough
- return;
- }
+ // one monster found, that's enough
+ return;
}
}
}
}
+ }
}
bool i_feel_safe(bool announce, bool want_move, bool just_monsters, int range)