diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-13 22:09:35 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-13 22:51:34 +0100 |
commit | b0d21459b7ec552fe6f9690d3d172bf6412551a9 (patch) | |
tree | 891cdd33dfa81f5060af2d1e0dbcb602b9c39d16 /crawl-ref/source/coord-circle.cc | |
parent | 8f81aa0a6fcb839a91b70e29d006f6858fb303b6 (diff) | |
download | crawl-ref-b0d21459b7ec552fe6f9690d3d172bf6412551a9.tar.gz crawl-ref-b0d21459b7ec552fe6f9690d3d172bf6412551a9.zip |
Reimplement radius_iterator on the basis of circle_def.
Diffstat (limited to 'crawl-ref/source/coord-circle.cc')
-rw-r--r-- | crawl-ref/source/coord-circle.cc | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/crawl-ref/source/coord-circle.cc b/crawl-ref/source/coord-circle.cc index 9072c6fa3e..8580313e01 100644 --- a/crawl-ref/source/coord-circle.cc +++ b/crawl-ref/source/coord-circle.cc @@ -63,6 +63,16 @@ const rect_def& circle_def::get_bbox() const return (bbox); } +const coord_def& circle_def::get_center() const +{ + return (origin); +} + +circle_iterator circle_def::iter() const +{ + return (circle_iterator(*this)); +} + bool circle_def::contains(const coord_def &p) const { switch (shape) @@ -75,32 +85,3 @@ bool circle_def::contains(const coord_def &p) const return (false); } } - -circle_iterator::circle_iterator(const circle_def &circle_) - : circle(circle_), iter(circle_.get_bbox().iter()) -{ - while (iter && !circle.contains(*iter)) - ++iter; -} - -circle_iterator::operator bool() const -{ - return ((bool)iter); -} - -coord_def circle_iterator::operator*() const -{ - return (*iter); -} - -void circle_iterator::operator++() -{ - do - ++iter; - while (iter && !circle.contains(*iter)); -} - -void circle_iterator::operator++(int) -{ - ++(*this); -} |