summaryrefslogtreecommitdiff
path: root/src/gui/windows/itemamountwindow.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/windows/itemamountwindow.cpp
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadmanaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
manaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
manaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
manaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/gui/windows/itemamountwindow.cpp')
-rw-r--r--src/gui/windows/itemamountwindow.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index dc318b103..d31e263c4 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -65,12 +65,12 @@ void ItemAmountWindow::finish(Item *const item,
const int price,
const ItemAmountWindowUsageT usage)
{
- if (!item)
+ if (item == nullptr)
return;
switch (usage)
{
case ItemAmountWindowUsage::TradeAdd:
- if (tradeWindow)
+ if (tradeWindow != nullptr)
tradeWindow->tradeItem(item, amount);
break;
case ItemAmountWindowUsage::ItemDrop:
@@ -88,11 +88,11 @@ void ItemAmountWindow::finish(Item *const item,
item->getInvIndex(), amount, InventoryType::Inventory);
break;
case ItemAmountWindowUsage::ShopBuyAdd:
- if (shopWindow)
+ if (shopWindow != nullptr)
shopWindow->addBuyItem(item, amount, price);
break;
case ItemAmountWindowUsage::ShopSellAdd:
- if (shopWindow)
+ if (shopWindow != nullptr)
shopWindow->addSellItem(item, amount, price);
break;
case ItemAmountWindowUsage::CartAdd:
@@ -104,13 +104,13 @@ void ItemAmountWindow::finish(Item *const item,
item->getInvIndex(), amount, InventoryType::Inventory);
break;
case ItemAmountWindowUsage::MailAdd:
- if (mailEditWindow)
+ if (mailEditWindow != nullptr)
mailEditWindow->addItem(item, amount);
break;
case ItemAmountWindowUsage::CraftAdd:
{
NpcDialog *const dialog = npcHandler->getCurrentNpcDialog();
- if (dialog)
+ if (dialog != nullptr)
dialog->addCraftItem(item, amount, price); // price as slot
break;
}
@@ -130,7 +130,7 @@ ItemAmountWindow::ItemAmountWindow(const ItemAmountWindowUsageT usage,
mItemPriceTextField(nullptr),
mGPLabel(nullptr),
mItem(item),
- mItemIcon(new Icon(this, item ? item->getImage() : nullptr)),
+ mItemIcon(new Icon(this, item != nullptr ? item->getImage() : nullptr)),
mItemAmountSlide(new Slider(this, 1.0, maxRange, 1.0)),
mItemPriceSlide(nullptr),
mItemDropDown(nullptr),
@@ -140,12 +140,12 @@ ItemAmountWindow::ItemAmountWindow(const ItemAmountWindowUsageT usage,
mUsage(usage),
mEnabledKeyboard(keyboard.isEnabled())
{
- if (!mItem)
+ if (mItem == nullptr)
return;
if (usage == ItemAmountWindowUsage::ShopBuyAdd)
mMax = 10000;
- else if (!mMax)
+ else if (mMax == 0)
mMax = mItem->getQuantity();
keyboard.setEnabled(false);
@@ -318,7 +318,7 @@ void ItemAmountWindow::mouseMoved(MouseEvent &event)
{
Window::mouseMoved(event);
- if (!viewport || !itemPopup)
+ if ((viewport == nullptr) || (itemPopup == nullptr))
return;
if (event.getSource() == mItemIcon)
@@ -331,7 +331,7 @@ void ItemAmountWindow::mouseMoved(MouseEvent &event)
// Hide ItemTooltip
void ItemAmountWindow::mouseExited(MouseEvent &event A_UNUSED)
{
- if (itemPopup)
+ if (itemPopup != nullptr)
itemPopup->setVisible(Visible_false);
}
@@ -350,7 +350,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
}
else if (eventId == "ok")
{
- if (mItemPriceTextField)
+ if (mItemPriceTextField != nullptr)
{
finish(mItem,
mItemAmountTextField->getValue(),
@@ -379,7 +379,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
}
else if (eventId == "itemType")
{
- if (!mItemDropDown || !mItemsModal)
+ if ((mItemDropDown == nullptr) || (mItemsModal == nullptr))
return;
const int id = ItemDB::get(mItemsModal->getElementAt(
@@ -398,7 +398,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
if (mUsage == ItemAmountWindowUsage::ShopBuyAdd)
mMax = 10000;
- else if (!mMax)
+ else if (mMax == 0)
mMax = mItem->getQuantity();
mItemIcon->setImage(mItem->getImage());
@@ -417,7 +417,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
mItemAmountTextField->setValue(amount);
mItemAmountSlide->setValue(amount);
- if (mItemPriceTextField && mItemPriceSlide)
+ if ((mItemPriceTextField != nullptr) && (mItemPriceSlide != nullptr))
{
if (mPrice > 7)
mPrice = 7;
@@ -443,7 +443,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
else if (eventId == "slidePrice")
{
price = CAST_S32(mItemPriceSlide->getValue());
- if (price)
+ if (price != 0)
mPrice = CAST_S32(log(static_cast<float>(price)));
else
mPrice = 0;
@@ -470,10 +470,10 @@ void ItemAmountWindow::showWindow(const ItemAmountWindowUsageT usage,
int maxRange,
int tag)
{
- if (!item)
+ if (item == nullptr)
return;
- if (!maxRange)
+ if (maxRange == 0)
maxRange = item->getQuantity();
if (usage != ItemAmountWindowUsage::ShopBuyAdd &&