diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-18 17:48:29 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-18 17:49:00 +0200 |
commit | f98d003e354a1792117b7cbc771d1dd91475a156 (patch) | |
tree | dc2a297f7c4026394c9954ae4bfd4abd22ef9612 /src/particleemitterprop.h | |
parent | bb0a6cb25b2985fd1f74c9d27d5a46f6863e2dee (diff) | |
download | manaverse-f98d003e354a1792117b7cbc771d1dd91475a156.tar.gz manaverse-f98d003e354a1792117b7cbc771d1dd91475a156.tar.bz2 manaverse-f98d003e354a1792117b7cbc771d1dd91475a156.tar.xz manaverse-f98d003e354a1792117b7cbc771d1dd91475a156.zip |
Fix most old style cast except manaserv and libxml2 defines.
Diffstat (limited to 'src/particleemitterprop.h')
-rw-r--r-- | src/particleemitterprop.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/particleemitterprop.h b/src/particleemitterprop.h index 5327005bc..5b0b22e4f 100644 --- a/src/particleemitterprop.h +++ b/src/particleemitterprop.h @@ -66,29 +66,33 @@ template <typename T> struct ParticleEmitterProp T value(int tick) { tick += changePhase; - T val = (T) (minVal + (maxVal - minVal) - * (rand() / ((double) RAND_MAX + 1))); + T val = static_cast<T>(minVal + (maxVal - minVal) + * (rand() / (static_cast<double>(RAND_MAX) + 1))); switch (changeFunc) { case FUNC_SINE: - val += (T) std::sin(M_PI * 2 * ((double)(tick % changePeriod) - / (double)changePeriod)) * changeAmplitude; + val += static_cast<T>(std::sin(M_PI * 2 * (static_cast<double>( + tick % changePeriod) / static_cast<double>( + changePeriod)))) * changeAmplitude; break; case FUNC_SAW: - val += (T) (changeAmplitude * ((double)(tick % changePeriod) - / (double)changePeriod)) * 2 - changeAmplitude; + val += static_cast<T>(changeAmplitude * (static_cast<double>( + tick % changePeriod) / static_cast<double>( + changePeriod))) * 2 - changeAmplitude; break; case FUNC_TRIANGLE: if ((tick % changePeriod) * 2 < changePeriod) { - val += changeAmplitude - (T)((tick % changePeriod) - / (double)changePeriod) * changeAmplitude * 4; + val += changeAmplitude - static_cast<T>(( + tick % changePeriod) / static_cast<double>( + changePeriod)) * changeAmplitude * 4; } else { - val += changeAmplitude * -3 + (T)((tick % changePeriod) - / (double)changePeriod) * changeAmplitude * 4; + val += changeAmplitude * -3 + static_cast<T>(( + tick % changePeriod) / static_cast<double>( + changePeriod)) * changeAmplitude * 4; // I have no idea why this works but it does } break; |