diff options
-rw-r--r-- | src/compoundsprite.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp index 3c16ff540..61fb3d4e0 100644 --- a/src/compoundsprite.cpp +++ b/src/compoundsprite.cpp @@ -61,8 +61,7 @@ CompoundSprite::CompoundSprite() : CompoundSprite::~CompoundSprite() { - delete_all(mSprites); - mSprites.clear(); + clear(); // delete mImage; mImage = nullptr; @@ -123,9 +122,6 @@ bool CompoundSprite::draw(Graphics *graphics, int posX, int posY) const if (mSprites.empty()) // Nothing to draw return false; -// posX += mOffsetX; -// posY += mOffsetY; - if (mAlpha == 1.0f && mImage) { return graphics->drawImage(mImage, posX + mOffsetX, posY + mOffsetY); @@ -286,11 +282,11 @@ void CompoundSprite::removeSprite(int layer) void CompoundSprite::clear() { // Skip if it won't change anything - if (mSprites.empty()) - return; - - delete_all(mSprites); - mSprites.clear(); + if (!mSprites.empty()) + { + delete_all(mSprites); + mSprites.clear(); + } mNeedsRedraw = true; delete_all(imagesCache); imagesCache.clear(); |