diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-02-22 13:02:26 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-02-22 14:32:45 +0100 |
commit | 81e4f170d8ba4ccbcfa1e6c07bd0522dfc3b6e08 (patch) | |
tree | e2619b16a5331e5760d94be389d0a3a01427293f /src/animatedsprite.h | |
parent | d047db79f7034e0e75a85a656d18f40716d197b9 (diff) | |
download | mana-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.h')
-rw-r--r-- | src/animatedsprite.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/animatedsprite.h b/src/animatedsprite.h index 67d3f300..f2e7a9ff 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -24,7 +24,6 @@ #include "sprite.h" -#include <map> #include <string> class Animation; @@ -60,7 +59,7 @@ class AnimatedSprite : public Sprite bool update(int time) override; - bool draw(Graphics* graphics, int posX, int posY) const override; + bool draw(Graphics *graphics, int posX, int posY) const override; int getWidth() const override; @@ -74,9 +73,6 @@ class AnimatedSprite : public Sprite bool setDirection(SpriteDirection direction) override; - int getNumberOfLayers() - { return 1; } - virtual bool drawnWhenBehind() const { return true; } @@ -85,16 +81,16 @@ class AnimatedSprite : public Sprite private: bool updateCurrentAnimation(unsigned int dt); - SpriteDirection mDirection; /**< The sprite direction. */ - int mLastTime; /**< The last time update was called. */ + SpriteDirection mDirection = DIRECTION_DOWN; /**< The sprite direction. */ + int mLastTime = 0; /**< The last time update was called. */ - int mFrameIndex; /**< The index of the current frame. */ - int mFrameTime; /**< The time since start of frame. */ + int mFrameIndex = 0; /**< The index of the current frame. */ + int mFrameTime = 0; /**< The time since start of frame. */ - SpriteDef *mSprite; /**< The sprite definition. */ - Action *mAction; /**< The currently active action. */ - Animation *mAnimation; /**< The currently active animation. */ - Frame *mFrame; /**< The currently active frame. */ + SpriteDef *mSprite; /**< The sprite definition. */ + Action *mAction = nullptr; /**< The currently active action. */ + Animation *mAnimation = nullptr; /**< The currently active animation. */ + Frame *mFrame = nullptr; /**< The currently active frame. */ }; #endif |