summaryrefslogtreecommitdiff
path: root/src/gui/widgets/emoteshortcutcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-06 23:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-07 19:23:40 +0300
commit36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch)
tree190156cb88b13a38a6d13c69ee0742cc078065a1 /src/gui/widgets/emoteshortcutcontainer.cpp
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadManaVerse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
ManaVerse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
ManaVerse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
ManaVerse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/gui/widgets/emoteshortcutcontainer.cpp')
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 0d75051eb..37acf7263 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -57,14 +57,14 @@ EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *restrict const
mEmoteClicked(false),
mEmoteMoved(0)
{
- if (mBackgroundImg)
+ if (mBackgroundImg != nullptr)
mBackgroundImg->setAlpha(settings.guiAlpha);
// Setup emote sprites
for (int i = 0; i <= EmoteDB::getLast(); i++)
{
const EmoteSprite *const sprite = EmoteDB::getSprite(i, true);
- if (sprite && sprite->sprite)
+ if ((sprite != nullptr) && (sprite->sprite != nullptr))
mEmoteImg.push_back(sprite);
}
@@ -85,13 +85,13 @@ void EmoteShortcutContainer::setWidget2(const Widget2 *restrict const widget)
void EmoteShortcutContainer::draw(Graphics *restrict graphics) restrict2
{
- if (!emoteShortcut)
+ if (emoteShortcut == nullptr)
return;
BLOCK_START("EmoteShortcutContainer::draw")
if (settings.guiAlpha != mAlpha)
{
- if (mBackgroundImg)
+ if (mBackgroundImg != nullptr)
mBackgroundImg->setAlpha(mAlpha);
mAlpha = settings.guiAlpha;
}
@@ -105,10 +105,10 @@ void EmoteShortcutContainer::draw(Graphics *restrict graphics) restrict2
for (unsigned i = 0; i < sz; i++)
{
const EmoteSprite *restrict const emoteImg = mEmoteImg[i];
- if (emoteImg)
+ if (emoteImg != nullptr)
{
const AnimatedSprite *restrict const sprite = emoteImg->sprite;
- if (sprite)
+ if (sprite != nullptr)
{
sprite->draw(graphics,
(i % mGridWidth) * mBoxWidth + 2,
@@ -137,13 +137,13 @@ void EmoteShortcutContainer::draw(Graphics *restrict graphics) restrict2
void EmoteShortcutContainer::safeDraw(Graphics *restrict graphics) restrict2
{
- if (!emoteShortcut)
+ if (emoteShortcut == nullptr)
return;
BLOCK_START("EmoteShortcutContainer::draw")
if (settings.guiAlpha != mAlpha)
{
- if (mBackgroundImg)
+ if (mBackgroundImg != nullptr)
mBackgroundImg->setAlpha(mAlpha);
mAlpha = settings.guiAlpha;
}
@@ -157,10 +157,10 @@ void EmoteShortcutContainer::safeDraw(Graphics *restrict graphics) restrict2
for (unsigned i = 0; i < sz; i++)
{
const EmoteSprite *restrict const emoteImg = mEmoteImg[i];
- if (emoteImg)
+ if (emoteImg != nullptr)
{
const AnimatedSprite *restrict const sprite = emoteImg->sprite;
- if (sprite)
+ if (sprite != nullptr)
{
sprite->draw(graphics,
(i % mGridWidth) * mBoxWidth + 2,
@@ -199,7 +199,7 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2
if (event.getButton() == MouseButton::LEFT)
{
- if (!emoteShortcut)
+ if (emoteShortcut == nullptr)
return;
const int index = getIndexFromGrid(event.getX(), event.getY());
@@ -214,14 +214,14 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2
emoteShortcut->setEmote(index);
emoteShortcut->setEmoteSelected(0);
}
- else if (emoteShortcut->getEmote(index))
+ else if (emoteShortcut->getEmote(index) != 0u)
{
mEmoteClicked = true;
}
}
else if (event.getButton() == MouseButton::RIGHT)
{
- if (popupMenu)
+ if (popupMenu != nullptr)
{
event.consume();
popupMenu->showEmoteType();
@@ -232,7 +232,7 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &restrict event) restrict2
void EmoteShortcutContainer::mouseReleased(MouseEvent &restrict event)
restrict2
{
- if (!emoteShortcut)
+ if (emoteShortcut == nullptr)
return;
if (event.getButton() == MouseButton::LEFT)
@@ -248,12 +248,12 @@ void EmoteShortcutContainer::mouseReleased(MouseEvent &restrict event)
return;
}
- if (mEmoteMoved)
+ if (mEmoteMoved != 0u)
{
emoteShortcut->setEmotes(index, mEmoteMoved);
mEmoteMoved = 0;
}
- else if (emoteShortcut->getEmote(index) && mEmoteClicked)
+ else if ((emoteShortcut->getEmote(index) != 0u) && mEmoteClicked)
{
emoteShortcut->useEmote(index + 1);
}
@@ -264,7 +264,7 @@ void EmoteShortcutContainer::mouseReleased(MouseEvent &restrict event)
void EmoteShortcutContainer::mouseMoved(MouseEvent &restrict event) restrict2
{
- if (!emoteShortcut || !textPopup)
+ if ((emoteShortcut == nullptr) || (textPopup == nullptr))
return;
const int index = getIndexFromGrid(event.getX(), event.getY());
@@ -274,7 +274,7 @@ void EmoteShortcutContainer::mouseMoved(MouseEvent &restrict event) restrict2
textPopup->setVisible(Visible_false);
- if (CAST_SIZE(index) < mEmoteImg.size() && mEmoteImg[index])
+ if (CAST_SIZE(index) < mEmoteImg.size() && (mEmoteImg[index] != nullptr))
{
const EmoteSprite *restrict const sprite = mEmoteImg[index];
textPopup->show(viewport->mMouseX, viewport->mMouseY,
@@ -285,13 +285,13 @@ void EmoteShortcutContainer::mouseMoved(MouseEvent &restrict event) restrict2
void EmoteShortcutContainer::mouseExited(MouseEvent &restrict event A_UNUSED)
restrict2
{
- if (textPopup)
+ if (textPopup != nullptr)
textPopup->setVisible(Visible_false);
}
void EmoteShortcutContainer::widgetHidden(const Event &restrict event A_UNUSED)
restrict2
{
- if (textPopup)
+ if (textPopup != nullptr)
textPopup->setVisible(Visible_false);
}