From 70eeeeec718a95bee1845c48545577551b2abbb7 Mon Sep 17 00:00:00 2001 From: pauldubois Date: Fri, 18 Apr 2008 08:01:53 +0000 Subject: 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 --- crawl-ref/source/misc.cc | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'crawl-ref/source/misc.cc') 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 &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 &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 &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) -- cgit v1.2.3-54-g00ecf