diff options
Diffstat (limited to 'src/animatedsprite.cpp')
-rw-r--r-- | src/animatedsprite.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index e1ca0a27d..e3ead0bf4 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -195,15 +195,15 @@ bool AnimatedSprite::updateCurrentAnimation(const unsigned int time) mFrameTime += time; - while ((mFrameTime > static_cast<unsigned>(mFrame->delay) + while ((mFrameTime > static_cast<unsigned int>(mFrame->delay) && mFrame->delay > 0) || (mFrame->type != Frame::ANIMATION && mFrame->type != Frame::PAUSE)) { bool fail(true); - mFrameTime -= static_cast<unsigned>(mFrame->delay); + mFrameTime -= static_cast<unsigned int>(mFrame->delay); mFrameIndex++; - if (mFrameIndex >= mAnimation->getLength()) + if (mFrameIndex >= static_cast<unsigned int>(mAnimation->getLength())) mFrameIndex = 0; mFrame = &mAnimation->mFrames[mFrameIndex]; @@ -227,8 +227,11 @@ bool AnimatedSprite::updateCurrentAnimation(const unsigned int time) && mFrame->nextAction == frame->nextAction) { mFrameIndex = static_cast<unsigned int>(i); - if (mFrameIndex >= mAnimation->getLength()) + if (mFrameIndex >= static_cast<unsigned int>( + mAnimation->getLength())) + { mFrameIndex = 0; + } mFrame = &mAnimation->mFrames[mFrameIndex]; @@ -262,7 +265,8 @@ bool AnimatedSprite::updateCurrentAnimation(const unsigned int time) } else { - if (mFrame->rand == 100 || mFrameIndex >= mAnimation->getLength()) + if (mFrame->rand == 100 || mFrameIndex + >= static_cast<unsigned int>(mAnimation->getLength())) { fail = false; } |