summaryrefslogtreecommitdiffstats
path: root/src/math/func.h
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-07-30 22:59:18 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-07-30 22:59:18 +0200
commit5e637ca0288ddd631ec33e1d620cd4a73bcdc2be (patch)
treeb26b0e9572f101744aba712133e646fb93ed58d2 /src/math/func.h
parentd8a0c8d32e160e7ae86bb5b85ead8e5f71b1fd01 (diff)
downloadcolobot-5e637ca0288ddd631ec33e1d620cd4a73bcdc2be.tar.gz
colobot-5e637ca0288ddd631ec33e1d620cd4a73bcdc2be.tar.bz2
colobot-5e637ca0288ddd631ec33e1d620cd4a73bcdc2be.zip
Switched to new style casts
- rewrote old C-style casts to new ..._cast<> - corrected some dangerous casts - added -Wold-style-cast to compile flags
Diffstat (limited to 'src/math/func.h')
-rw-r--r--src/math/func.h10
1 files changed, 5 insertions, 5 deletions
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<int>(a / m) ) * m;
}
//! Returns a random value between 0 and 1.
inline float Rand()
{
- return (float)rand()/RAND_MAX;
+ return static_cast<float>(rand()) / static_cast<float>(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<float>(a) * DEG_TO_RAD;
+ float bb = static_cast<float>(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