summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-07-13 04:55:04 -0400
committerNeil Moore <neil@s-z.org>2014-07-13 05:04:20 -0400
commit366234d7866321869deb3bc75800a91091f3adeb (patch)
tree64206f0d7e3aa6970090c1a96c6161181ef79cd8 /crawl-ref/source/effects.cc
parent8caa665a5bfd477586b1619f879ee4dcd979859a (diff)
downloadcrawl-ref-366234d7866321869deb3bc75800a91091f3adeb.tar.gz
crawl-ref-366234d7866321869deb3bc75800a91091f3adeb.zip
Remove some duplicate code.
We had a template to compare pairs by their second member, and two separate classes to do the same thing for specific pair types. Remove the non-generic versions, and move the template to libutil.h.
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc16
1 files changed, 2 insertions, 14 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index d57421d1ae..6e98d0e4cf 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2373,19 +2373,6 @@ void update_level(int elapsedTime)
delete_cloud(i);
}
-// A comparison struct for use in an stl priority queue.
-template<typename T>
-struct greater_second
-{
- // The stl priority queue is a max queue and uses < as the default
- // comparison. We want a min queue so we have to use a > operation
- // here.
- bool operator()(const T & left, const T & right)
- {
- return left.second > right.second;
- }
-};
-
// Basically we want to break a circle into n_arcs equal sized arcs and find
// out which arc the input point pos falls on.
static int _arc_decomposition(const coord_def & pos, int n_arcs)
@@ -2459,7 +2446,8 @@ void collect_radius_points(vector<vector<coord_def> > &radius_points,
// Using a priority queue because squares don't make very good circles at
// larger radii. We will visit points in order of increasing euclidean
- // distance from the origin (not path distance).
+ // distance from the origin (not path distance). We want a min queue
+ // based on the distance, so we use greater_second as the comparator.
priority_queue<coord_dist, vector<coord_dist>,
greater_second<coord_dist> > fringe;