Fixed round_to_int to handle negative numbers properly
[monky] / src / common.c
index ae1db7c..9001178 100644 (file)
@@ -289,5 +289,9 @@ void update_stuff()
 
 int round_to_int(float f)
 {
-    return (int) (f + 0.5);
+       if (f >= 0.0) {
+               return (int) (f + 0.5);
+       } else {
+               return (int) (f - 0.5);
+       }
 }