summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-06 19:25:37 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-06 19:26:33 +0100
commit8786fef5e47392ca5c3daa8e932c10e7c1ef9715 (patch)
tree88a59a682b4a82ce44b0c1f3b9a3a59ecee624a5
parentf626e442c7a77191a145825507610d3b1ef40ab3 (diff)
downloadcrawl-ref-8786fef5e47392ca5c3daa8e932c10e7c1ef9715.tar.gz
crawl-ref-8786fef5e47392ca5c3daa8e932c10e7c1ef9715.zip
Implement actor::can_see.
This just relies on actor::visible_to and actor::see_cell. An arena special case was removed.
-rw-r--r--crawl-ref/source/actor.cc5
-rw-r--r--crawl-ref/source/actor.h2
-rw-r--r--crawl-ref/source/monster.cc5
-rw-r--r--crawl-ref/source/monster.h1
-rw-r--r--crawl-ref/source/player.cc8
-rw-r--r--crawl-ref/source/player.h1
6 files changed, 6 insertions, 16 deletions
diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc
index 83dcc799aa..b00125f5b7 100644
--- a/crawl-ref/source/actor.cc
+++ b/crawl-ref/source/actor.cc
@@ -17,6 +17,11 @@ bool actor::observable() const
return (crawl_state.arena || this == &you || you.can_see(this));
}
+bool actor::can_see(const actor *target) const
+{
+ return (target->visible_to(this) && see_cell(target->pos()));
+}
+
bool actor::has_equipped(equipment_type eq, int sub_type) const
{
const item_def *item = slot_item(eq);
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h
index b48945847d..69ae5ebf79 100644
--- a/crawl-ref/source/actor.h
+++ b/crawl-ref/source/actor.h
@@ -109,7 +109,7 @@ public:
virtual bool see_cell(const coord_def &c) const = 0;
// Can the actor actually see the target?
- virtual bool can_see(const actor *target) const = 0;
+ virtual bool can_see(const actor *target) const;
// Visibility as required by messaging. In usual play:
// Does the player know what's happening to the actor?
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 28f44c2c7b..affe0e3836 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -5159,11 +5159,6 @@ bool monsters::see_cell(const coord_def &c) const
return (mon_see_cell(c));
}
-bool monsters::can_see(const actor *targ) const
-{
- return (targ->visible_to(this) && see_cell(targ->pos()));
-}
-
bool monsters::near_foe() const
{
const actor *afoe = get_foe();
diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h
index d19af87d5f..5138f6b6f7 100644
--- a/crawl-ref/source/monster.h
+++ b/crawl-ref/source/monster.h
@@ -317,7 +317,6 @@ public:
bool visible_to(const actor *looker) const;
bool mon_see_cell(const coord_def& pos, bool reach = false) const;
bool see_cell(const coord_def& c) const;
- bool can_see(const actor *target) const;
bool near_foe() const;
bool is_icy() const;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index abd9b69748..b4b02a9c02 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6903,14 +6903,6 @@ bool player::see_cell(const coord_def &c) const
return (::see_cell(c));
}
-bool player::can_see(const actor *target) const
-{
- if (crawl_state.arena)
- return target->visible_to(this);
-
- return (target->visible_to(this) && see_cell(target->pos()));
-}
-
bool player::backlit(bool check_haloed) const
{
return (get_contamination_level() > 0 || duration[DUR_BACKLIGHT]
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 7e8fa551b8..0d113ff5b2 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -318,7 +318,6 @@ public:
bool can_see_invisible(bool unid) const;
bool visible_to(const actor *looker) const;
bool see_cell(const coord_def &c) const;
- bool can_see(const actor *target) const;
bool is_icy() const;
bool is_fiery() const;