diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/misc.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/xom.cc | 29 |
2 files changed, 9 insertions, 29 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 342e7f96ae..c1115df870 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -2759,6 +2759,15 @@ bool i_feel_safe(bool announce, bool want_move, bool just_monsters, int range) return (false); } +bool there_are_monsters_nearby() +{ + // Monster check. + std::vector<monsters*> visible; + get_playervisible_monsters(visible, false, true); + + return (!visible.empty()); +} + static const char *shop_types[] = { "weapon", "armour", diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index d5507f12e6..cb40a50823 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -382,35 +382,6 @@ bool xom_gives_item(int power) return (true); } -bool there_are_monsters_nearby() -{ - const int ystart = MAX(0, you.y_pos - 9); - const int yend = MIN(GYM - 1, you.y_pos + 9); - const int xstart = MAX(0, you.x_pos - 9); - const int xend = MIN(GXM - 1, you.x_pos + 9); - - // Monster check. - for (int y = ystart; y <= yend; ++y) - { - for (int x = xstart; x <= xend; ++x) - { - // If you can see a monster, then it's nearby. - if (see_grid(x, y)) - { - const int targ_monst = mgrd[x][y]; - if (targ_monst != NON_MONSTER) - { - const monsters *mon = &menv[targ_monst]; - if (!mons_is_submerged(mon)) - return (true); - } - } - } - } - - return (false); -} - static bool choose_mutatable_monster(const monsters* mon) { return (mon->alive() && mon->can_safely_mutate() |