From 5e637ca0288ddd631ec33e1d620cd4a73bcdc2be Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Mon, 30 Jul 2012 22:59:18 +0200 Subject: Switched to new style casts - rewrote old C-style casts to new ..._cast<> - corrected some dangerous casts - added -Wold-style-cast to compile flags --- src/math/func.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/math/func.h') diff --git a/src/math/func.h b/src/math/func.h index 9a417dc..2127d1a 100644 --- a/src/math/func.h +++ b/src/math/func.h @@ -118,13 +118,13 @@ inline void Swap(float &a, float &b) Mod(n, 1) = fractional part of n */ inline float Mod(float a, float m) { - return a - ((int)(a/m))*m; + return a - ( static_cast(a / m) ) * m; } //! Returns a random value between 0 and 1. inline float Rand() { - return (float)rand()/RAND_MAX; + return static_cast(rand()) / static_cast(RAND_MAX); } //! Returns a normalized angle, that is in other words between 0 and 2 * PI @@ -153,10 +153,10 @@ inline bool TestAngle(float angle, float min, float max) //! Calculates a value (radians) proportional between a and b (degrees) inline float PropAngle(int a, int b, float p) { - float aa = (float)a * DEG_TO_RAD; - float bb = (float)b * DEG_TO_RAD; + float aa = static_cast(a) * DEG_TO_RAD; + float bb = static_cast(b) * DEG_TO_RAD; - return aa+p*(bb-aa); + return aa + p * (bb - aa); } //! Calculates the angle to rotate the angle \a a to the angle \a g -- cgit v1.2.3-1-g7c22