summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-movetarget.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-04 19:20:56 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-05 05:14:16 +0100
commit5114b4b827b5b56b3f5e6a204c682c3ac77ad755 (patch)
tree183b95a620df7b62a21223605ad877f85beb75cc /crawl-ref/source/mon-movetarget.cc
parent1f1809d2796684ad03af05bea3754acb0e2e513d (diff)
downloadcrawl-ref-5114b4b827b5b56b3f5e6a204c682c3ac77ad755.tar.gz
crawl-ref-5114b4b827b5b56b3f5e6a204c682c3ac77ad755.zip
Get rid of the radius_iterator "legacy" constructor.
It was really weird: working on a square, but in almost all cases restricting it to your view (a circle). Note this is _your_ view rather than from the iterator's center -- which hasn't been used once in the obvious interesting way. As usual, this commit fixes a load of "act through glass" bugs, ando/or using los modes that don't make sense in the context.
Diffstat (limited to 'crawl-ref/source/mon-movetarget.cc')
-rw-r--r--crawl-ref/source/mon-movetarget.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/crawl-ref/source/mon-movetarget.cc b/crawl-ref/source/mon-movetarget.cc
index f009a7ffff..0c229ac53a 100644
--- a/crawl-ref/source/mon-movetarget.cc
+++ b/crawl-ref/source/mon-movetarget.cc
@@ -21,7 +21,7 @@
#include "traps.h"
// If a monster can see but not directly reach the target, and then fails to
-// find a path to get there, mark all surrounding (in a radius of 2) monsters
+// find a path to get there, mark all surrounding (in a radius of √8) monsters
// of the same (or greater) movement restrictions as also being unable to
// find a path, so we won't need to calculate again.
// Should there be a direct path to the target for a monster thus marked, it
@@ -38,7 +38,7 @@ static void _mark_neighbours_target_unreachable(monster* mon)
const bool amphibious = (mons_habitat(mon) == HT_AMPHIBIOUS);
const habitat_type habit = mons_primary_habitat(mon);
- for (radius_iterator ri(mon->pos(), 2, true, false); ri; ++ri)
+ for (radius_iterator ri(mon->pos(), 8, C_CIRCLE); ri; ++ri)
{
if (*ri == mon->pos())
continue;
@@ -339,7 +339,7 @@ bool find_siren_water_target(monster* mon)
while (true)
{
int best_num = 0;
- for (radius_iterator ri(mon->pos(), LOS_RADIUS, true, false);
+ for (radius_iterator ri(mon->pos(), LOS_NO_TRANS);
ri; ++ri)
{
if (!feat_is_water(grd(*ri)))
@@ -455,7 +455,7 @@ bool find_wall_target(monster* mon)
bool best_closer_to_player = false;
coord_def best_target;
- for (radius_iterator ri(mon->pos(), LOS_RADIUS, true, false);
+ for (radius_iterator ri(mon->pos(), you.current_vision, C_ROUND);
ri; ++ri)
{
if (!cell_is_solid(*ri)
@@ -669,13 +669,11 @@ static bool _choose_random_patrol_target_grid(monster* mon)
}
int count_grids = 0;
- for (radius_iterator ri(mon->patrol_point, LOS_RADIUS, true, false);
+ // Don't bother for the current position. If everything fails,
+ // we'll stay here anyway.
+ for (radius_iterator ri(mon->patrol_point, you.current_vision, C_ROUND, true);
ri; ++ri)
{
- // Don't bother for the current position. If everything fails,
- // we'll stay here anyway.
- if (*ri == mon->pos())
- continue;
if (!in_bounds(*ri) || !mon->can_pass_through_feat(grd(*ri)))
continue;