summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/coordit.h
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-13 22:33:47 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-13 22:51:35 +0100
commiteecba1f24c550b8cc3a25831e77aa744622e31c4 (patch)
treee2f647f66edec7aeefb0ef93e74b4a4ea6489191 /crawl-ref/source/coordit.h
parentd958695281c7c79be672abda7cdaf673c27514e6 (diff)
downloadcrawl-ref-eecba1f24c550b8cc3a25831e77aa744622e31c4.tar.gz
crawl-ref-eecba1f24c550b8cc3a25831e77aa744622e31c4.zip
Some radius_iterator documentation.
Diffstat (limited to 'crawl-ref/source/coordit.h')
-rw-r--r--crawl-ref/source/coordit.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/crawl-ref/source/coordit.h b/crawl-ref/source/coordit.h
index da17c67a7b..1759b396c7 100644
--- a/crawl-ref/source/coordit.h
+++ b/crawl-ref/source/coordit.h
@@ -34,22 +34,34 @@ public:
void operator++(int);
};
+/*
+ * radius_iterator: Iterator over coordinates in a more-or-less
+ * circular region.
+ *
+ * The region can be any circle_def; furthermore, the cells can
+ * be restricted to lie within some LOS field (need not be
+ * centered at the same point), and to exclude the center.
+ */
class los_def;
class radius_iterator : public std::iterator<std::forward_iterator_tag,
coord_def>
{
public:
+ // General constructor.
radius_iterator(const coord_def& center, int param,
circle_type ctype,
const los_def* los = NULL,
bool exclude_center = false);
+ // Legacy constructor -- use above instead.
radius_iterator(const coord_def& center, int radius,
bool roguelike_metric = true,
bool require_los = true,
bool exclude_center = false,
const los_def* los = NULL);
+ // Just iterate over a LOS field.
radius_iterator(const los_def* los,
bool exclude_center = false);
+
operator bool() const;
coord_def operator *() const;
const coord_def* operator->() const;
@@ -64,8 +76,8 @@ private:
circle_def circle;
circle_iterator iter;
bool exclude_center;
- const los_def* los;
- coord_def current;
+ const los_def* los; // restrict to the los if not NULL
+ coord_def current; // storage for operater->
};
class adjacent_iterator : public radius_iterator