summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-07 23:13:30 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-08 01:31:41 +0100
commit05c8dfaba3d73566693df38b1e170c803e016842 (patch)
tree95347ff95d893e30a2c3101ba074c1a4e570bec2
parent5a1a9596b2b2d2d36df854fbea7adb6d4bb8c605 (diff)
downloadcrawl-ref-05c8dfaba3d73566693df38b1e170c803e016842.tar.gz
crawl-ref-05c8dfaba3d73566693df38b1e170c803e016842.zip
Remove player.h dependency from coordit.h.
adjacent_iterator had a default center of you.pos(), which is now gone (also the uses of). I was running into circular header dependencies with actor.h including los_def.h including coordit.h including player.h including actor.h.
-rw-r--r--crawl-ref/source/coordit.h4
-rw-r--r--crawl-ref/source/decks.cc2
-rw-r--r--crawl-ref/source/files.cc2
-rw-r--r--crawl-ref/source/godabil.cc2
-rw-r--r--crawl-ref/source/monster.cc4
-rw-r--r--crawl-ref/source/monstuff.cc2
-rw-r--r--crawl-ref/source/spells1.cc2
-rw-r--r--crawl-ref/source/spells3.cc2
-rw-r--r--crawl-ref/source/stuff.cc2
-rw-r--r--crawl-ref/source/xom.cc2
10 files changed, 11 insertions, 13 deletions
diff --git a/crawl-ref/source/coordit.h b/crawl-ref/source/coordit.h
index ecf57fad53..d4624c9ec7 100644
--- a/crawl-ref/source/coordit.h
+++ b/crawl-ref/source/coordit.h
@@ -1,8 +1,6 @@
#ifndef COORDIT_H
#define COORDIT_H
-#include "player.h"
-
class rectangle_iterator :
public std::iterator<std::forward_iterator_tag, coord_def>
{
@@ -50,7 +48,7 @@ private:
class adjacent_iterator : public radius_iterator
{
public:
- explicit adjacent_iterator( const coord_def& pos = you.pos(),
+ explicit adjacent_iterator( const coord_def& pos,
bool _exclude_center = true ) :
radius_iterator(pos, 1, true, false, _exclude_center) {}
};
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 04c15feea8..7f44093d9b 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -1485,7 +1485,7 @@ static void _warpwright_card(int power, deck_rarity_type rarity)
int count = 0;
coord_def f;
- for (adjacent_iterator ai; ai; ++ai)
+ for (adjacent_iterator ai(you.pos()); ai; ++ai)
if (grd(*ai) == DNGN_FLOOR && !find_trap(*ai) && one_chance_in(++count))
f = *ai;
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index b9b9769e77..38673237d8 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1059,7 +1059,7 @@ static void _grab_followers()
int non_stair_using_allies = 0;
// Handle nearby ghosts.
- for (adjacent_iterator ai; ai; ++ai)
+ for (adjacent_iterator ai(you.pos()); ai; ++ai)
{
monsters *fmenv = monster_at(*ai);
if (fmenv == NULL)
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index e55d2bb69b..b203cc95a0 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -1304,7 +1304,7 @@ void cheibriados_time_bend(int pow)
{
mpr("The flow of time bends around you.");
- for (adjacent_iterator ai; ai; ++ai)
+ for (adjacent_iterator ai(you.pos()); ai; ++ai)
{
monsters* mon = monster_at(*ai);
if (mon != NULL && !mons_is_stationary(mon))
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index aa756c120e..7896fd321b 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -4031,7 +4031,7 @@ static bool _prepare_del_ench(monsters* mon, const mon_enchant &me)
coord_def target_square;
int okay_squares = 0;
- for (adjacent_iterator ai; ai; ++ai)
+ for (adjacent_iterator ai(you.pos()); ai; ++ai)
if (!actor_at(*ai)
&& monster_can_submerge(mon, grd(*ai))
&& one_chance_in(++okay_squares))
@@ -4052,7 +4052,7 @@ static bool _prepare_del_ench(monsters* mon, const mon_enchant &me)
// The terrain changed and the monster can't remain submerged.
// Try to move to an adjacent square where it would be happy.
- for (adjacent_iterator ai; ai; ++ai)
+ for (adjacent_iterator ai(you.pos()); ai; ++ai)
{
if (!monster_at(*ai)
&& monster_habitable_grid(mon, grd(*ai))
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index ad93c3e5d1..c39de4d164 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2655,7 +2655,7 @@ bool swap_check(monsters *monster, coord_def &loc, bool quiet)
{
int num_found = 0;
- for (adjacent_iterator ai; ai; ++ai)
+ for (adjacent_iterator ai(you.pos()); ai; ++ai)
if (!monster_at(*ai) && _habitat_okay(monster, grd(*ai))
&& one_chance_in(++num_found))
{
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 835030f6eb..2f798cadf1 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -1576,7 +1576,7 @@ void manage_fire_shield()
mpr("Your ring of flames is guttering out.", MSGCH_WARN);
// Place fire clouds all around you
- for ( adjacent_iterator ai; ai; ++ai )
+ for ( adjacent_iterator ai(you.pos()); ai; ++ai )
if (!feat_is_solid(grd(*ai)) && env.cgrid(*ai) == EMPTY_CLOUD)
place_cloud( CLOUD_FIRE, *ai, 1 + random2(6), KC_YOU );
}
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index a92006b6ff..519be912fa 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -1655,7 +1655,7 @@ bool entomb(int powc)
DNGN_FLOOR_SPECIAL
};
- for ( adjacent_iterator ai; ai; ++ai )
+ for ( adjacent_iterator ai(you.pos()); ai; ++ai )
{
// Tile already occupied by monster
if (monster_at(*ai))
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 2eee5c8992..097e6e0a60 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -232,7 +232,7 @@ static int follower_tag_radius2()
{
// If only friendlies are adjacent, we set a max radius of 6, otherwise
// only adjacent friendlies may follow.
- for (adjacent_iterator ai; ai; ++ai)
+ for (adjacent_iterator ai(you.pos()); ai; ++ai)
{
if (const monsters *mon = monster_at(*ai))
if (!mon->friendly())
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 0edc00cb39..8cd082be50 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -2824,7 +2824,7 @@ static int _xom_player_confusion_effect(int sever, bool debug = false)
if (!_xom_feels_nasty())
{
// Don't confuse the player if standing next to lava or deep water.
- for (adjacent_iterator ai; ai; ++ai)
+ for (adjacent_iterator ai(you.pos()); ai; ++ai)
if (in_bounds(*ai) && is_feat_dangerous(grd(*ai)))
return (XOM_DID_NOTHING);
}