From cff4feea6b0ee0249b6955c0783a302df77b82c4 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sun, 16 Nov 2008 22:07:46 +0000 Subject: fixed rounding errors in the character core causing it to favour certain directions --- src/base/math.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/base/math.hpp') diff --git a/src/base/math.hpp b/src/base/math.hpp index 5e3f7ede..302935d7 100644 --- a/src/base/math.hpp +++ b/src/base/math.hpp @@ -19,6 +19,13 @@ inline float sign(float f) return f<0.0f?-1.0f:1.0f; } +inline int round(float f) +{ + if(f > 0) + return (int)(f+0.5f); + return (int)(f-0.5f); +} + template inline T mix(const T a, const T b, TB amount) { -- cgit 1.4.1