summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/exclude.cc
diff options
context:
space:
mode:
authorRobert Burnham <burnhamrobertp@gmail.com>2011-10-25 15:38:46 -0500
committerRobert Burnham <burnhamrobertp@gmail.com>2011-10-25 15:38:46 -0500
commitce5cd1e9df7f220ee7d07b285b76473ec9fb928f (patch)
tree9f56ef300bc15746c2cde58dcbd09c2df1bdac95 /crawl-ref/source/exclude.cc
parent71b738e8b44d6dad14c29bc898eff2ac700e9e1e (diff)
parent5efc2ebb172e0046e26e8b4a5114359f2e217628 (diff)
downloadcrawl-ref-ce5cd1e9df7f220ee7d07b285b76473ec9fb928f.tar.gz
crawl-ref-ce5cd1e9df7f220ee7d07b285b76473ec9fb928f.zip
Merge branch 'master' into unified_combat_control
Conflicts: crawl-ref/source/Makefile.obj crawl-ref/source/dbg-scan.cc crawl-ref/source/decks.cc crawl-ref/source/describe.cc crawl-ref/source/directn.cc crawl-ref/source/evoke.cc crawl-ref/source/fight.cc crawl-ref/source/fight.h crawl-ref/source/ghost.cc crawl-ref/source/ghost.h crawl-ref/source/item_use.cc crawl-ref/source/items.cc crawl-ref/source/map_knowledge.cc crawl-ref/source/melee_attack.h crawl-ref/source/mon-abil.cc crawl-ref/source/mon-act.cc crawl-ref/source/mon-stuff.cc crawl-ref/source/monster.cc crawl-ref/source/monster.h crawl-ref/source/player.cc crawl-ref/source/player.h crawl-ref/source/shopping.cc crawl-ref/source/spl-damage.cc crawl-ref/source/spl-summoning.cc crawl-ref/source/spl-transloc.cc crawl-ref/source/stairs.cc crawl-ref/source/stuff.cc crawl-ref/source/tags.cc crawl-ref/source/traps.cc crawl-ref/source/xom.cc
Diffstat (limited to 'crawl-ref/source/exclude.cc')
-rw-r--r--crawl-ref/source/exclude.cc25
1 files changed, 10 insertions, 15 deletions
diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc
index 4f08ceedb9..b328c6624a 100644
--- a/crawl-ref/source/exclude.cc
+++ b/crawl-ref/source/exclude.cc
@@ -18,7 +18,6 @@
#include "map_knowledge.h"
#include "mon-util.h"
#include "options.h"
-#include "stuff.h"
#include "env.h"
#include "tags.h"
#include "terrain.h"
@@ -29,20 +28,14 @@
static bool _mon_needs_auto_exclude(const monster* mon, bool sleepy = false)
{
if (mons_is_stationary(mon))
- {
- if (sleepy)
- return (false);
+ return (!sleepy);
- // Don't give away mimics unless already known.
- return (!mons_is_mimic(mon->type)
- || testbits(mon->flags, MF_KNOWN_MIMIC));
- }
// Auto exclusion only makes sense if the monster is still asleep.
return (mon->asleep());
}
// Check whether a given monster is listed in the auto_exclude option.
-bool need_auto_exclude(const monster* mon, bool sleepy)
+static bool _need_auto_exclude(const monster* mon, bool sleepy = false)
{
// This only works if the name is lowercased.
std::string name = mon->name(DESC_BASENAME,
@@ -65,7 +58,9 @@ bool need_auto_exclude(const monster* mon, bool sleepy)
// Nightstalker reduces LOS, so reducing the maximum exclusion radius
// only makes sense. This is only possible because it's a permanent
// mutation; the lantern of Shadows should not have this effect.
-int _get_full_exclusion_radius()
+// TODO: update the radiuses on wield/unwield, we already need to do that
+// when gaining/losing nightstalker.
+static int _get_full_exclusion_radius()
{
return (LOS_RADIUS - player_mutation_level(MUT_NIGHTSTALKER));
}
@@ -74,10 +69,10 @@ int _get_full_exclusion_radius()
// exclusion.
void set_auto_exclude(const monster* mon)
{
- if (!player_in_mappable_area())
+ if (!is_map_persistent())
return;
- if (need_auto_exclude(mon) && !is_exclude_root(mon->pos()))
+ if (_need_auto_exclude(mon) && !is_exclude_root(mon->pos()))
{
int rad = _get_full_exclusion_radius();
if (mon->type == MONS_HYPERACTIVE_BALLISTOMYCETE)
@@ -101,7 +96,7 @@ void set_auto_exclude(const monster* mon)
// player in sight. If sleepy is true, stationary monsters are ignored.
void remove_auto_exclude(const monster* mon, bool sleepy)
{
- if (need_auto_exclude(mon, sleepy))
+ if (_need_auto_exclude(mon, sleepy))
{
del_exclude(mon->pos());
#ifdef USE_TILE
@@ -434,7 +429,7 @@ void deferred_exclude_update()
void clear_excludes()
{
// Sanity checks
- if (!player_in_mappable_area())
+ if (!is_map_persistent())
return;
#ifdef USE_TILE
@@ -500,7 +495,7 @@ void del_exclude(const coord_def &p)
void set_exclude(const coord_def &p, int radius, bool autoexcl, bool vaultexcl,
bool defer_updates)
{
- if (!player_in_mappable_area()) // currently only Abyss
+ if (!is_map_persistent())
return;
if (!in_bounds(p))