diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-13 21:57:30 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-13 22:51:34 +0100 |
commit | d15c5257fbe4fc12651fa1b59745550d87f4df8d (patch) | |
tree | 94445dc5202d09d201826bf1c08aee93318455df /crawl-ref/source/coord-circle.cc | |
parent | 46d8063d5ceb41d1ae6109405189b7c1baf2c211 (diff) | |
download | crawl-ref-d15c5257fbe4fc12651fa1b59745550d87f4df8d.tar.gz crawl-ref-d15c5257fbe4fc12651fa1b59745550d87f4df8d.zip |
Make circle_def aware of map bounds.
circle_def now has two modes, depending on whether origin is set.
This is a little ugly.
Diffstat (limited to 'crawl-ref/source/coord-circle.cc')
-rw-r--r-- | crawl-ref/source/coord-circle.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crawl-ref/source/coord-circle.cc b/crawl-ref/source/coord-circle.cc index 135924e33f..a4d98ad505 100644 --- a/crawl-ref/source/coord-circle.cc +++ b/crawl-ref/source/coord-circle.cc @@ -71,6 +71,8 @@ void circle_def::init(int param, circle_type ctype) } bbox = rect_def(origin - coord_def(radius, radius), origin + coord_def(radius, radius)); + if (!origin.origin()) + bbox = bbox.intersect(RECT_MAP_BOUNDS); } const rect_def& circle_def::get_bbox() const @@ -90,6 +92,8 @@ circle_iterator circle_def::iter() const bool circle_def::contains(const coord_def &p) const { + if (!bbox.contains(p)) + return (false); switch (shape) { case SH_SQUARE: |