summaryrefslogtreecommitdiff
path: root/src/imageparticle.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-18 17:48:29 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-18 17:49:00 +0200
commitf98d003e354a1792117b7cbc771d1dd91475a156 (patch)
treedc2a297f7c4026394c9954ae4bfd4abd22ef9612 /src/imageparticle.cpp
parentbb0a6cb25b2985fd1f74c9d27d5a46f6863e2dee (diff)
downloadmanaplus-f98d003e354a1792117b7cbc771d1dd91475a156.tar.gz
manaplus-f98d003e354a1792117b7cbc771d1dd91475a156.tar.bz2
manaplus-f98d003e354a1792117b7cbc771d1dd91475a156.tar.xz
manaplus-f98d003e354a1792117b7cbc771d1dd91475a156.zip
Fix most old style cast except manaserv and libxml2 defines.
Diffstat (limited to 'src/imageparticle.cpp')
-rw-r--r--src/imageparticle.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp
index ec1a62fd0..2d4f21337 100644
--- a/src/imageparticle.cpp
+++ b/src/imageparticle.cpp
@@ -66,8 +66,8 @@ bool ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const
if (!isAlive() || !mImage)
return false;
- int screenX = (int) mPos.x + offsetX - mImage->getWidth() / 2;
- int screenY = (int) mPos.y - (int)mPos.z
+ int screenX = static_cast<int>(mPos.x) + offsetX - mImage->getWidth() / 2;
+ int screenY = static_cast<int>(mPos.y) - static_cast<int>(mPos.z)
+ offsetY - mImage->getHeight() / 2;
// Check if on screen
@@ -82,10 +82,16 @@ bool ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const
float alphafactor = mAlpha;
if (mFadeOut && mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut)
- alphafactor *= (float) mLifetimeLeft / (float) mFadeOut;
+ {
+ alphafactor *= static_cast<float>(mLifetimeLeft)
+ / static_cast<float>(mFadeOut);
+ }
if (mFadeIn && mLifetimePast < mFadeIn)
- alphafactor *= (float) mLifetimePast / (float) mFadeIn;
+ {
+ alphafactor *= static_cast<float>(mLifetimePast)
+ / static_cast<float>(mFadeIn);
+ }
mImage->setAlpha(alphafactor);
return graphics->drawImage(mImage, screenX, screenY);