diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-09 00:15:44 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-09 00:15:44 +0000 |
commit | 4c9a1ad6cf83954f217ff4570ddf6010c401e803 (patch) | |
tree | 7f3b5e7be3c6b2ab5620a9aec942b3f38d30ce58 /crawl-ref | |
parent | fffe9fb7f46a3c4f10837a40b1b72347ddd60a0b (diff) | |
download | crawl-ref-4c9a1ad6cf83954f217ff4570ddf6010c401e803.tar.gz crawl-ref-4c9a1ad6cf83954f217ff4570ddf6010c401e803.zip |
Add reset() method to radius_iterator so that a single iterator
instance can be re-used.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5619 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/stuff.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/stuff.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 38b0a247c9..92ba9294ec 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -83,6 +83,13 @@ radius_iterator::radius_iterator( const coord_def& _center, int _radius, require_los(_require_los), exclude_center(_exclude_center), iter_done(false) { + reset(); +} + +void radius_iterator::reset() +{ + iter_done = false; + location.x = center.x - radius; location.y = center.y - radius; diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h index 87688b5a57..66e492c7ca 100644 --- a/crawl-ref/source/stuff.h +++ b/crawl-ref/source/stuff.h @@ -57,6 +57,7 @@ public: bool require_los = true, bool exclude_center = false ); bool done() const; + void reset(); operator bool() const { return !done(); } coord_def operator *() const; |