summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-24 22:58:51 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-24 23:02:25 +0100
commit4f9a9aa77bc073af76876932dc0244b42eabfbff (patch)
tree41ca8f4162365619d2f06a1fea0a3be9c5a64e30 /crawl-ref/source/directn.cc
parent7e011d2d22e2e83430468e7e110516f8f60df8ce (diff)
downloadcrawl-ref-4f9a9aa77bc073af76876932dc0244b42eabfbff.tar.gz
crawl-ref-4f9a9aa77bc073af76876932dc0244b42eabfbff.zip
Make object targetting heed range and needs_path.
Also simplify mimic handling by referring to map_knowledge.
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r--crawl-ref/source/directn.cc21
1 files changed, 6 insertions, 15 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 8a41fc96ef..24fc63c7f4 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -2077,25 +2077,16 @@ static bool _find_feature( const coord_def& where, int mode,
}
static bool _find_object(const coord_def& where, int mode,
- bool /* need_path */, int /* range */)
+ bool need_path, int range)
{
- // First, check for mimics.
- bool is_mimic = false;
- const monsters* m = monster_at(where);
- if (m
- && m->visible_to(&you)
- && mons_is_mimic(m->type)
- && !(m->flags & MF_KNOWN_MIMIC))
- {
- is_mimic = true;
- }
+ // Don't target out of range.
+ if (!_is_target_in_range(where, range))
+ return (false);
- const int item = igrd(where);
- if (item == NON_ITEM && !is_mimic)
+ if (need_path && (!you.see_cell(where) || _blocked_ray(where)))
return (false);
- return (in_los(where) || is_terrain_seen(where)
- && (is_stash(where.x,where.y) || is_mimic));
+ return (env.map_knowledge(where).item() != SHOW_ITEM_NONE);
}
static int _next_los(int dir, int los, bool wrap)