diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-03 13:30:18 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-03 15:27:26 +0100 |
commit | ccf8d8af59e39c6f9699662a31c8105a1b79ae36 (patch) | |
tree | 266bd9b14fa7fce74758613470970308dda8ef1d /crawl-ref | |
parent | 31c79607507ed1c1db3162fe3165fe15c7fcb9ee (diff) | |
download | crawl-ref-ccf8d8af59e39c6f9699662a31c8105a1b79ae36.tar.gz crawl-ref-ccf8d8af59e39c6f9699662a31c8105a1b79ae36.zip |
Add round_vec.
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/ray.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc index 69d43f5da8..6418386a61 100644 --- a/crawl-ref/source/ray.cc +++ b/crawl-ref/source/ray.cc @@ -84,13 +84,18 @@ static bool in_non_diamond_int(const geom::vector &v) return (!in_diamond(v) && !on_line(v)); } +static coord_def round_vec(const geom::vector &v) +{ + int x = ifloor(v.x); + int y = ifloor(v.y); + return (coord_def(x, y)); +} + coord_def ray_def::pos() const { // XXX: pretty arbitrary if we're just on a corner. - int x = ifloor(r.start.x); - int y = ifloor(r.start.y); - return (coord_def(x, y)); + return (round_vec(r.start)); } static bool _advance_from_non_diamond(geom::ray *r) |