summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/AppHdr.h3
-rw-r--r--crawl-ref/source/ray.cc4
2 files changed, 5 insertions, 2 deletions
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h
index fcaa373b09..a911f883c8 100644
--- a/crawl-ref/source/AppHdr.h
+++ b/crawl-ref/source/AppHdr.h
@@ -199,6 +199,9 @@
#include <dos.h>
+ // It's sad we don't use autoconf...
+ #define round(x) floor((x)+0.5)
+
// Use Perl-compatible regular expressions. libpcre must be available and
// linked in. This is optional.
#ifndef REGEX_PCRE
diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc
index 2b7c091085..f2b8c067ef 100644
--- a/crawl-ref/source/ray.cc
+++ b/crawl-ref/source/ray.cc
@@ -29,7 +29,7 @@ static int _ifloor(double d)
static int iround(double d)
{
- return static_cast<int>(floor(d+0.5));
+ return static_cast<int>(round(d));
}
static int ifloor(double d)
@@ -43,7 +43,7 @@ static int ifloor(double d)
static bool double_is_integral(double d)
{
- return (double_is_zero(d - floor(d+0.5)));
+ return (double_is_zero(d - round(d)));
}
// Is v in the interiour of a diamond?