diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-11 17:47:32 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-11 18:05:00 +0200 |
commit | 4b84fa4805af04d59d98eba0425be894831e7383 (patch) | |
tree | 7b40540fe59309afa2f97a9fba77d84f9f5efa55 /crawl-ref/source/ray.h | |
parent | 0f2a6c57d47cc0e5e55198914a3a67f25f2af380 (diff) | |
download | crawl-ref-4b84fa4805af04d59d98eba0425be894831e7383.tar.gz crawl-ref-4b84fa4805af04d59d98eba0425be894831e7383.zip |
Use floor() instead of static_cast<int> for rounding.
This way the code is less likely to fall over with negative
coordinates.
Diffstat (limited to 'crawl-ref/source/ray.h')
-rw-r--r-- | crawl-ref/source/ray.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/ray.h b/crawl-ref/source/ray.h index 03e8fc4749..1500f39cfc 100644 --- a/crawl-ref/source/ray.h +++ b/crawl-ref/source/ray.h @@ -22,9 +22,9 @@ public: public: ray_def(double accx = 0.0, double accy = 0.0, double slope = 0.0, int quadrant = 0, int fullray_idx = -1); - int x() const { return static_cast<int>(accx); } - int y() const { return static_cast<int>(accy); } - coord_def pos() const { return coord_def(x(), y()); } + int x() const; + int y() const; + coord_def pos() const; // returns the direction taken (0,1,2) int advance(bool shorten = false, const coord_def *p = NULL); |