summaryrefslogtreecommitdiff
path: root/src/gui/widgets/virtshortcutcontainer.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/virtshortcutcontainer.cpp
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/gui/widgets/virtshortcutcontainer.cpp')
-rw-r--r--src/gui/widgets/virtshortcutcontainer.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/gui/widgets/virtshortcutcontainer.cpp b/src/gui/widgets/virtshortcutcontainer.cpp
index dda7217c4..6b7642a3d 100644
--- a/src/gui/widgets/virtshortcutcontainer.cpp
+++ b/src/gui/widgets/virtshortcutcontainer.cpp
@@ -52,7 +52,7 @@ VirtShortcutContainer::VirtShortcutContainer(Widget2 *const widget,
mUnEquipedColor2(getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED_OUTLINE)),
mShortcut(shortcut)
{
- if (mShortcut)
+ if (mShortcut != nullptr)
mMaxItems = mShortcut->getItemCount();
else
mMaxItems = 0;
@@ -73,21 +73,21 @@ void VirtShortcutContainer::setWidget2(const Widget2 *const widget)
void VirtShortcutContainer::draw(Graphics *const graphics)
{
- if (!mShortcut)
+ if (mShortcut == nullptr)
return;
BLOCK_START("VirtShortcutContainer::draw")
if (settings.guiAlpha != mAlpha)
{
mAlpha = settings.guiAlpha;
- if (mBackgroundImg)
+ if (mBackgroundImg != nullptr)
mBackgroundImg->setAlpha(mAlpha);
}
drawBackground(graphics);
const Inventory *const inv = PlayerInfo::getInventory();
- if (!inv)
+ if (inv == nullptr)
{
BLOCK_END("VirtShortcutContainer::draw")
return;
@@ -106,12 +106,12 @@ void VirtShortcutContainer::draw(Graphics *const graphics)
const Item *const item = inv->findItem(mShortcut->getItem(i),
mShortcut->getItemColor(i));
- if (item)
+ if (item != nullptr)
{
// Draw item icon.
Image *const image = item->getImage();
- if (image)
+ if (image != nullptr)
{
std::string caption;
if (item->getQuantity() > 1)
@@ -147,21 +147,21 @@ void VirtShortcutContainer::draw(Graphics *const graphics)
void VirtShortcutContainer::safeDraw(Graphics *const graphics)
{
- if (!mShortcut)
+ if (mShortcut == nullptr)
return;
BLOCK_START("VirtShortcutContainer::safeDraw")
if (settings.guiAlpha != mAlpha)
{
mAlpha = settings.guiAlpha;
- if (mBackgroundImg)
+ if (mBackgroundImg != nullptr)
mBackgroundImg->setAlpha(mAlpha);
}
safeDrawBackground(graphics);
const Inventory *const inv = PlayerInfo::getInventory();
- if (!inv)
+ if (inv == nullptr)
{
BLOCK_END("VirtShortcutContainer::safeDraw")
return;
@@ -180,12 +180,12 @@ void VirtShortcutContainer::safeDraw(Graphics *const graphics)
const Item *const item = inv->findItem(mShortcut->getItem(i),
mShortcut->getItemColor(i));
- if (item)
+ if (item != nullptr)
{
// Draw item icon.
Image *const image = item->getImage();
- if (image)
+ if (image != nullptr)
{
std::string caption;
if (item->getQuantity() > 1)
@@ -221,7 +221,7 @@ void VirtShortcutContainer::safeDraw(Graphics *const graphics)
void VirtShortcutContainer::mouseDragged(MouseEvent &event)
{
- if (!mShortcut)
+ if (mShortcut == nullptr)
return;
if (event.getButton() == MouseButton::LEFT)
@@ -240,12 +240,12 @@ void VirtShortcutContainer::mouseDragged(MouseEvent &event)
return;
const Inventory *const inv = PlayerInfo::getInventory();
- if (!inv)
+ if (inv == nullptr)
return;
Item *const item = inv->findItem(itemId, itemColor);
- if (item)
+ if (item != nullptr)
{
dragDrop.dragItem(item, DragDropSource::Drop);
mShortcut->removeItem(index);
@@ -260,7 +260,7 @@ void VirtShortcutContainer::mouseDragged(MouseEvent &event)
void VirtShortcutContainer::mousePressed(MouseEvent &event)
{
- if (!mShortcut || !inventoryWindow)
+ if ((mShortcut == nullptr) || (inventoryWindow == nullptr))
return;
const int index = getIndexFromGrid(event.getX(), event.getY());
@@ -290,13 +290,13 @@ void VirtShortcutContainer::mousePressed(MouseEvent &event)
else if (eventButton == MouseButton::RIGHT)
{
const Inventory *const inv = PlayerInfo::getInventory();
- if (!inv)
+ if (inv == nullptr)
return;
Item *const item = inv->findItem(mShortcut->getItem(index),
mShortcut->getItemColor(index));
- if (popupMenu)
+ if (popupMenu != nullptr)
{
popupMenu->showDropPopup(viewport->mMouseX,
viewport->mMouseY,
@@ -307,7 +307,7 @@ void VirtShortcutContainer::mousePressed(MouseEvent &event)
void VirtShortcutContainer::mouseReleased(MouseEvent &event)
{
- if (!mShortcut)
+ if (mShortcut == nullptr)
return;
if (event.getButton() == MouseButton::LEFT)
@@ -339,7 +339,7 @@ void VirtShortcutContainer::mouseReleased(MouseEvent &event)
// Show ItemTooltip
void VirtShortcutContainer::mouseMoved(MouseEvent &event)
{
- if (!mShortcut)
+ if (mShortcut == nullptr)
return;
const int index = getIndexFromGrid(event.getX(), event.getY());
@@ -354,12 +354,12 @@ void VirtShortcutContainer::mouseMoved(MouseEvent &event)
return;
const Inventory *const inv = PlayerInfo::getInventory();
- if (!inv)
+ if (inv == nullptr)
return;
const Item *const item = inv->findItem(itemId, itemColor);
- if (item && viewport)
+ if ((item != nullptr) && (viewport != nullptr))
{
itemPopup->setItem(item, false);
itemPopup->position(viewport->mMouseX, viewport->mMouseY);
@@ -372,12 +372,12 @@ void VirtShortcutContainer::mouseMoved(MouseEvent &event)
void VirtShortcutContainer::mouseExited(MouseEvent &event A_UNUSED)
{
- if (itemPopup)
+ if (itemPopup != nullptr)
itemPopup->setVisible(Visible_false);
}
void VirtShortcutContainer::widgetHidden(const Event &event A_UNUSED)
{
- if (itemPopup)
+ if (itemPopup != nullptr)
itemPopup->setVisible(Visible_false);
}