diff options
author | Adam Borowski <kilobyte@angband.pl> | 2010-11-08 02:03:31 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2010-11-09 16:06:41 +0100 |
commit | f56cf0f1551de5811abed949a22414553b9143f1 (patch) | |
tree | 40a3a0bfe3a51d1e31cd75414dabd7d69298e3b9 /crawl-ref/source/coordit.h | |
parent | 3923d31ba85ef1a5106fa3323fab6e8c07cbe6db (diff) | |
download | crawl-ref-f56cf0f1551de5811abed949a22414553b9143f1.tar.gz crawl-ref-f56cf0f1551de5811abed949a22414553b9143f1.zip |
Fix max_radius in distance_iterator, rename it again, allow querying current radius.
Diffstat (limited to 'crawl-ref/source/coordit.h')
-rw-r--r-- | crawl-ref/source/coordit.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crawl-ref/source/coordit.h b/crawl-ref/source/coordit.h index dbfff64b01..505f482f3e 100644 --- a/crawl-ref/source/coordit.h +++ b/crawl-ref/source/coordit.h @@ -88,15 +88,15 @@ public: radius_iterator(pos, 1, C_SQUARE, NULL, _exclude_center) {} }; -/* equidistant_iterator: Iterates over coordinates in integer ranges. Unlike other +/* distance_iterator: Iterates over coordinates in integer ranges. Unlike other * iterators, it tries hard to not favorize any particular * direction (unless fair = false, when it saves some CPU). */ -class equidistant_iterator : +class distance_iterator : public std::iterator<std::forward_iterator_tag, coord_def> { public: - equidistant_iterator(const coord_def& _center, + distance_iterator(const coord_def& _center, bool _fair = true, bool exclude_center = true, int _max_radius = 107); @@ -104,12 +104,13 @@ public: coord_def operator *() const; const coord_def* operator->() const; - const equidistant_iterator& operator ++(); - equidistant_iterator operator ++(int); + const distance_iterator& operator ++(); + distance_iterator operator ++(int); + int radius() const; private: coord_def center, current; std::vector<coord_def> lists[3], *vcur, *vnear, *vfar; - int radius, max_radius; + int r, max_radius; int threshold; unsigned int icur, iend; bool fair; |