summaryrefslogtreecommitdiff
path: root/src/animatedsprite.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-22 13:02:26 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-22 14:32:45 +0100
commit81e4f170d8ba4ccbcfa1e6c07bd0522dfc3b6e08 (patch)
treee2619b16a5331e5760d94be389d0a3a01427293f /src/animatedsprite.cpp
parentd047db79f7034e0e75a85a656d18f40716d197b9 (diff)
downloadmana-81e4f170d8ba4ccbcfa1e6c07bd0522dfc3b6e08.tar.gz
mana-81e4f170d8ba4ccbcfa1e6c07bd0522dfc3b6e08.tar.bz2
mana-81e4f170d8ba4ccbcfa1e6c07bd0522dfc3b6e08.tar.xz
mana-81e4f170d8ba4ccbcfa1e6c07bd0522dfc3b6e08.zip
General code cleanups
* Use default member initializers * Use range-based loops * Don't use 'else' after 'return' * Removed some unused includes * Construct empty strings with std::string() instead of "" * Clear strings with .clear() instead of assigning "" * Check whether strings are empty with .empty() instead of comparing to "" * Removed redundant initializations
Diffstat (limited to 'src/animatedsprite.cpp')
-rw-r--r--src/animatedsprite.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index a9138e36..61f14550 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -31,19 +31,10 @@
#include <cassert>
AnimatedSprite::AnimatedSprite(SpriteDef *sprite):
- mDirection(DIRECTION_DOWN),
- mLastTime(0),
- mFrameIndex(0),
- mFrameTime(0),
- mSprite(sprite),
- mAction(nullptr),
- mAnimation(nullptr),
- mFrame(nullptr)
+ mSprite(sprite)
{
assert(mSprite);
- mAlpha = 1.0f;
-
// Take possession of the sprite
mSprite->incRef();
@@ -203,18 +194,16 @@ int AnimatedSprite::getDuration() const
int AnimatedSprite::getWidth() const
{
- if (mFrame)
- return mFrame->image ? mFrame->image->getWidth() : 0;
- else
- return 0;
+ if (mFrame && mFrame->image)
+ return mFrame->image->getWidth();
+ return 0;
}
int AnimatedSprite::getHeight() const
{
- if (mFrame)
- return mFrame->image ? mFrame->image->getHeight() : 0;
- else
- return 0;
+ if (mFrame && mFrame->image)
+ return mFrame->image->getHeight();
+ return 0;
}
int AnimatedSprite::getOffsetX() const