summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-06 19:11:08 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-06 19:16:19 +0100
commit4412160c9f7d6410f7974e6daf1027716547cceb (patch)
treec48612e4bb41b55a8efd36273e5e98cd9f4a4404
parentdef6a88b388cdcf3ac08c2144b9d30f6c8bfb010 (diff)
downloadcrawl-ref-4412160c9f7d6410f7974e6daf1027716547cceb.tar.gz
crawl-ref-4412160c9f7d6410f7974e6daf1027716547cceb.zip
Make some passed references const.
A couple of the Feawn functions were passed read-only arguments (coordinate center, etc.) as non-const references, which leaked out to require you.pos() to be non-const.
-rw-r--r--crawl-ref/source/effects.cc14
-rw-r--r--crawl-ref/source/effects.h14
-rw-r--r--crawl-ref/source/spells2.cc4
-rw-r--r--crawl-ref/source/spells2.h3
4 files changed, 18 insertions, 17 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 92fa7690d0..9dbced7c40 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -4305,12 +4305,12 @@ static int _arc_decomposition(const coord_def & pos, int n_arcs)
return static_cast<int> (theta / arc_angle);
}
-int place_ring(std::vector<coord_def> & ring_points,
- coord_def & origin,
- mgen_data & prototype,
- int n_arcs,
- int arc_occupancy,
- int & seen_count)
+int place_ring(std::vector<coord_def> &ring_points,
+ const coord_def &origin,
+ mgen_data prototype,
+ int n_arcs,
+ int arc_occupancy,
+ int &seen_count)
{
std::random_shuffle(ring_points.begin(),
ring_points.end());
@@ -4349,7 +4349,7 @@ int place_ring(std::vector<coord_def> & ring_points,
// Collect lists of points that are within LOS (under the given env map),
// unoccupied, and not solid (walls/statues).
void collect_radius_points(std::vector<std::vector<coord_def> > &radius_points,
- coord_def & origin, env_show_grid & losgrid)
+ const coord_def &origin, const env_show_grid &losgrid)
{
radius_points.clear();
diff --git a/crawl-ref/source/effects.h b/crawl-ref/source/effects.h
index fe13baee0f..dd23f6ba67 100644
--- a/crawl-ref/source/effects.h
+++ b/crawl-ref/source/effects.h
@@ -42,17 +42,17 @@ int spawn_corpse_mushrooms(item_def &corpse,
bool distance_as_time = false);
struct mgen_data;
-int place_ring(std::vector<coord_def> & ring_points,
- coord_def & origin,
- mgen_data & prototype,
- int n_arcs,
- int arc_occupancy,
- int & seen_count);
+int place_ring(std::vector<coord_def>& ring_points,
+ const coord_def& origin,
+ mgen_data prototype,
+ int n_arcs,
+ int arc_occupancy,
+ int& seen_count);
// Collect lists of points that are within LOS (under the given losgrid),
// unoccupied, and not solid (walls/statues).
void collect_radius_points(std::vector<std::vector<coord_def> > &radius_points,
- coord_def & origin, env_show_grid & losgrid);
+ const coord_def &origin, const env_show_grid &losgrid);
void random_uselessness(int scroll_slot = -1);
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index b0f2f38563..e91d251949 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -2106,7 +2106,7 @@ void point_point(std::vector<coord_def> & origins,
// to calculate the distances in question. In practice it should be called for
// at most 7 searches since 8 (all adjacent free, > 8 monsters in view) can be
// special cased easily.
-bool prioritise_adjacent(coord_def & target, std::vector<coord_def> & candidates)
+bool prioritise_adjacent(const coord_def &target, std::vector<coord_def> & candidates)
{
radius_iterator los_it(target, LOS_RADIUS, true, true, true);
@@ -2114,7 +2114,7 @@ bool prioritise_adjacent(coord_def & target, std::vector<coord_def> & candidates
// collect hostile monster positions in LOS
for ( ; los_it; ++los_it)
{
- monsters * hostile = monster_at(*los_it);
+ monsters *hostile = monster_at(*los_it);
if (hostile && hostile->attitude == ATT_HOSTILE)
mons_positions.push_back(hostile->pos());
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index 124032f9f4..dcc02dfed2 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -32,7 +32,8 @@ int create_plant(coord_def & target);
//bool plant_from_fruit();
bool sunlight();
-bool prioritise_adjacent(coord_def & target, std::vector<coord_def> & candidates);
+bool prioritise_adjacent(const coord_def &target,
+ std::vector<coord_def> &candidates);
bool plant_ring_from_fruit();
int rain(const coord_def &target);