From 48a10f839f12790b3ec1f6cb5c50820180ae8339 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 29 Jul 2016 18:43:12 +0300 Subject: Fix some issues detected by cppcheck. --- src/actions/commands.cpp | 6 +++--- src/being/castingeffect.cpp | 8 ++++---- src/being/castingeffect.h | 3 --- src/resources/mobileopenglscreenshothelper.cpp | 1 + 4 files changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index ce4093110..0d3111b59 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1166,11 +1166,11 @@ impHandler(craft) impHandler(npcClipboard) { - int x = 0; - int y = 0; - if (npcHandler) { + int x = 0; + int y = 0; + NpcDialog *const dialog = npcHandler->getCurrentNpcDialog(); if (dialog && parse2Int(event.args, x, y)) diff --git a/src/being/castingeffect.cpp b/src/being/castingeffect.cpp index abacfde48..d879c5ab6 100644 --- a/src/being/castingeffect.cpp +++ b/src/being/castingeffect.cpp @@ -43,17 +43,17 @@ CastingEffect::CastingEffect(const int skillId, Actor(), mSprite(animation.empty() ? nullptr : AnimatedSprite::load(paths.getStringValue("sprites") + animation)), - mPixelX(x * mapTileSize), - mPixelY(y * mapTileSize), mRectX((x - range) * mapTileSize), mRectY((y - range) * mapTileSize), mRectSize(range * mapTileSize * 2 + mapTileSize), mAnimationX(mRectX + (mRectSize - (mSprite ? mSprite->getWidth() : 0)) / 2), mAnimationY(mRectY + (mRectSize - (mSprite ? - mSprite->getHeight() : 0)) / 2), - mYDiff(range * mapTileSize + 31) + mSprite->getHeight() : 0)) / 2) { + mPixelX = x * mapTileSize; + mPixelY = y * mapTileSize; + mYDiff = range * mapTileSize + 31; if (!mSprite) { reportAlways("Skill %d/%d casting animation '%s' load failed", diff --git a/src/being/castingeffect.h b/src/being/castingeffect.h index 6958da880..fceccc10c 100644 --- a/src/being/castingeffect.h +++ b/src/being/castingeffect.h @@ -66,14 +66,11 @@ class CastingEffect final : public Actor protected: AnimatedSprite *mSprite; - int mPixelX; - int mPixelY; int mRectX; int mRectY; int mRectSize; int mAnimationX; int mAnimationY; - int mYDiff; }; #endif // BEING_CASTINGEFFECT_H diff --git a/src/resources/mobileopenglscreenshothelper.cpp b/src/resources/mobileopenglscreenshothelper.cpp index e6da43e95..57f024031 100644 --- a/src/resources/mobileopenglscreenshothelper.cpp +++ b/src/resources/mobileopenglscreenshothelper.cpp @@ -82,6 +82,7 @@ SDL_Surface *MobileOpenGLScreenshotHelper::getScreenshot() if (!screenshot) { MSDL_FreeSurface(tmpImage); + delete [] buf; return nullptr; } -- cgit v1.2.3-60-g2f50