summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/areas.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-10-28 19:23:55 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-10-31 16:57:53 +0100
commitd0b9e0fa3f62ab5b1ecb7fdb1a7ae3ea26449be3 (patch)
tree4d20cc76e8630ffa458b879af3d4708022459047 /crawl-ref/source/areas.cc
parent57c8949bf5b30bdce6ba1df95e28da16ba5e7f4b (diff)
downloadcrawl-ref-d0b9e0fa3f62ab5b1ecb7fdb1a7ae3ea26449be3.tar.gz
crawl-ref-d0b9e0fa3f62ab5b1ecb7fdb1a7ae3ea26449be3.zip
Get rid of most types of actor_iterator.
Diffstat (limited to 'crawl-ref/source/areas.cc')
-rw-r--r--crawl-ref/source/areas.cc152
1 files changed, 78 insertions, 74 deletions
diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc
index a0691534eb..d836d9d504 100644
--- a/crawl-ref/source/areas.cc
+++ b/crawl-ref/source/areas.cc
@@ -96,109 +96,113 @@ void areas_actor_moved(const actor* act, const coord_def& oldpos)
}
}
-static void _update_agrid()
+static void _actor_areas(actor *a)
{
- if (no_areas)
+ int r;
+
+ if ((r = a->silence_radius2()) >= 0)
{
- _agrid_valid = true;
- return;
+ _agrid_centres.push_back(area_centre(AREA_SILENCE, a->pos(), r));
+
+ for (radius_iterator ri(a->pos(), r, C_CIRCLE); ri; ++ri)
+ _set_agrid_flag(*ri, APROP_SILENCE);
+ no_areas = false;
}
- _agrid.init(0);
- _agrid_centres.clear();
+ // Just like silence, suppression goes through walls
+ if ((r = a->suppression_radius2()) >= 0)
+ {
+ _agrid_centres.push_back(area_centre(AREA_SUPPRESSION, a->pos(), r));
- no_areas = true;
+ for (radius_iterator ri(a->pos(), r, C_CIRCLE); ri; ++ri)
+ _set_agrid_flag(*ri, APROP_SUPPRESSION);
+ no_areas = false;
+ }
- for (actor_iterator ai; ai; ++ai)
+ if ((r = a->halo_radius2()) >= 0)
{
- int r;
+ _agrid_centres.push_back(area_centre(AREA_HALO, a->pos(), r));
- if ((r = ai->silence_radius2()) >= 0)
+ for (radius_iterator ri(a->pos(), r, C_CIRCLE, a->get_los());
+ ri; ++ri)
{
- _agrid_centres.push_back(area_centre(AREA_SILENCE, ai->pos(), r));
-
- for (radius_iterator ri(ai->pos(), r, C_CIRCLE); ri; ++ri)
- _set_agrid_flag(*ri, APROP_SILENCE);
- no_areas = false;
+ _set_agrid_flag(*ri, APROP_HALO);
}
+ no_areas = false;
+ }
- // Just like silence, suppression goes through walls
- if ((r = ai->suppression_radius2()) >= 0)
- {
- _agrid_centres.push_back(area_centre(AREA_SUPPRESSION, ai->pos(), r));
-
- for (radius_iterator ri(ai->pos(), r, C_CIRCLE); ri; ++ri)
- _set_agrid_flag(*ri, APROP_SUPPRESSION);
- no_areas = false;
- }
+ if ((r = a->liquefying_radius2()) >= 0)
+ {
+ _agrid_centres.push_back(area_centre(AREA_LIQUID, a->pos(), r));
- if ((r = ai->halo_radius2()) >= 0)
+ for (radius_iterator ri(a->pos(), r, C_CIRCLE, a->get_los());
+ ri; ++ri)
{
- _agrid_centres.push_back(area_centre(AREA_HALO, ai->pos(), r));
+ dungeon_feature_type f = grd(*ri);
- for (radius_iterator ri(ai->pos(), r, C_CIRCLE, ai->get_los());
- ri; ++ri)
- {
- _set_agrid_flag(*ri, APROP_HALO);
- }
- no_areas = false;
+ _set_agrid_flag(*ri, APROP_LIQUID);
+
+ if (feat_has_solid_floor(f) && !feat_is_water(f))
+ _set_agrid_flag(*ri, APROP_ACTUAL_LIQUID);
}
+ no_areas = false;
+ }
- if ((r = ai->liquefying_radius2()) >= 0)
- {
- _agrid_centres.push_back(area_centre(AREA_LIQUID, ai->pos(), r));
+ if ((r = a->umbra_radius2()) >= 0)
+ {
+ _agrid_centres.push_back(area_centre(AREA_UMBRA, a->pos(), r));
- for (radius_iterator ri(ai->pos(), r, C_CIRCLE, ai->get_los());
- ri; ++ri)
- {
- dungeon_feature_type f = grd(*ri);
+ for (radius_iterator ri(a->pos(), r, C_CIRCLE, a->get_los());
+ ri; ++ri)
+ {
+ _set_agrid_flag(*ri, APROP_UMBRA);
+ }
+ no_areas = false;
+ }
- _set_agrid_flag(*ri, APROP_LIQUID);
- if (feat_has_solid_floor(f) && !feat_is_water(f))
- _set_agrid_flag(*ri, APROP_ACTUAL_LIQUID);
- }
- no_areas = false;
- }
+ if ((r = a->soul_aura_radius2()) >= 0)
+ {
+ _agrid_centres.push_back(area_centre(AREA_SOUL_AURA, a->pos(), r));
- if ((r = ai->umbra_radius2()) >= 0)
+ for (radius_iterator ri(a->pos(), r, C_CIRCLE, a->get_los());
+ ri; ++ri)
{
- _agrid_centres.push_back(area_centre(AREA_UMBRA, ai->pos(), r));
-
- for (radius_iterator ri(ai->pos(), r, C_CIRCLE, ai->get_los());
- ri; ++ri)
- {
- _set_agrid_flag(*ri, APROP_UMBRA);
- }
- no_areas = false;
+ _set_agrid_flag(*ri, APROP_SOUL_AURA);
}
+ no_areas = false;
+ }
+ if ((r = a->heat_radius2()) >= 0)
+ {
+ _agrid_centres.push_back(area_centre(AREA_HOT, a->pos(), r));
- if ((r = ai->soul_aura_radius2()) >= 0)
+ for (radius_iterator ri(a->pos(),r, C_CIRCLE, a->get_los());
+ ri; ++ri)
{
- _agrid_centres.push_back(area_centre(AREA_SOUL_AURA, ai->pos(), r));
-
- for (radius_iterator ri(ai->pos(), r, C_CIRCLE, ai->get_los());
- ri; ++ri)
- {
- _set_agrid_flag(*ri, APROP_SOUL_AURA);
- }
- no_areas = false;
+ _set_agrid_flag(*ri, APROP_HOT);
}
+ no_areas = false;
+ }
+}
- if ((r = ai->heat_radius2()) >= 0)
- {
- _agrid_centres.push_back(area_centre(AREA_HOT, ai->pos(), r));
-
- for (radius_iterator ri(ai->pos(),r, C_CIRCLE, ai->get_los());
- ri; ++ri)
- {
- _set_agrid_flag(*ri, APROP_HOT);
- }
- no_areas = false;
- }
+static void _update_agrid()
+{
+ if (no_areas)
+ {
+ _agrid_valid = true;
+ return;
}
+ _agrid.init(0);
+ _agrid_centres.clear();
+
+ no_areas = true;
+
+ _actor_areas(&you);
+ for (monster_iterator mi; mi; ++mi)
+ _actor_areas(*mi);
+
if (you.char_direction == GDT_ASCENDING && !you.pos().origin())
{
const int r = 5;