summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-18 09:40:53 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-18 09:40:53 +0000
commite2cbc98a162d37386b3191ccf16c0d64ad7bb1b2 (patch)
tree3c3fc7e3c9e0cf7bfaded82101d233492dac2216 /crawl-ref/source/directn.cc
parent8f675841ee07a21138fe098204f46018d28ea3b5 (diff)
downloadcrawl-ref-e2cbc98a162d37386b3191ccf16c0d64ad7bb1b2.tar.gz
crawl-ref-e2cbc98a162d37386b3191ccf16c0d64ad7bb1b2.zip
Pull code from mon->can_see(target) into a new function mon->see_grid()
and use it in the checks for monster/monster visibility. I didn't have the time to test it but it should at least solve part of the problem of monsters firing through walls (if monster visibility is even checked there, which I don't know). Also (as usually), more code cleanup. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5117 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r--crawl-ref/source/directn.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 1622723094..33d2bb0a2e 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -486,15 +486,15 @@ void direction(dist& moves, targeting_type restricts,
bool target_unshifted = Options.target_unshifted_dirs;
// Find a default target
- if ( Options.default_target && mode == TARG_ENEMY )
+ if (Options.default_target && mode == TARG_ENEMY)
{
skip_iter = true; // skip first iteration...XXX mega-hack
- if ( you.prev_targ != MHITNOT && you.prev_targ != MHITYOU )
+ if (you.prev_targ != MHITNOT && you.prev_targ != MHITYOU)
{
const monsters *montarget = &menv[you.prev_targ];
- if ( mons_near(montarget) && player_monster_visible(montarget)
- && !mons_friendly(montarget) // not made friendly since then
- && _is_target_in_range(montarget->x, montarget->y, range) )
+ if (mons_near(montarget) && player_monster_visible(montarget)
+ && !mons_friendly(montarget) // not made friendly since then
+ && _is_target_in_range(montarget->x, montarget->y, range))
{
found_autotarget = true;
moves.tx = montarget->x;