summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-02 21:17:13 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-02 21:17:13 +0300
commit181ecd0c3bf27b47487f973fb83b988fd6ceaecf (patch)
tree4ee3de6acd80bf81d0960ac49d64f718f5019102 /src/gui/inventorywindow.cpp
parentfb1709d774139b2173da6ee95770abaad23f726e (diff)
downloadmanaplus-181ecd0c3bf27b47487f973fb83b988fd6ceaecf.tar.gz
manaplus-181ecd0c3bf27b47487f973fb83b988fd6ceaecf.tar.bz2
manaplus-181ecd0c3bf27b47487f973fb83b988fd6ceaecf.tar.xz
manaplus-181ecd0c3bf27b47487f973fb83b988fd6ceaecf.zip
Another fixes after Coverity checks.
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 9f6fda689..fe51018bf 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -311,7 +311,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
mItems->setName(mNameFilter->getText());
mItems->updateMatrix();
}
- else if (!eventId.find("tag_") && mItems)
+ else if (!eventId.find("tag_"))
{
std::string tagName = event.getId().substr(4);
mItems->setFilter(ItemDB::getTagId(tagName));
@@ -398,8 +398,7 @@ void InventoryWindow::unselectItem()
void InventoryWindow::widgetHidden(const gcn::Event &event)
{
Window::widgetHidden(event);
- if (mItems)
- mItems->hidePopup();
+ mItems->hidePopup();
}
void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
@@ -590,16 +589,19 @@ void InventoryWindow::updateButtons(const Item *item)
if (mDropButton)
mDropButton->setEnabled(true);
- if (mUseButton && item && item->isEquipment())
+ if (mUseButton)
{
- if (item->isEquipped())
- mUseButton->setCaption(_("Unequip"));
+ if (item && item->isEquipment())
+ {
+ if (item->isEquipped())
+ mUseButton->setCaption(_("Unequip"));
+ else
+ mUseButton->setCaption(_("Equip"));
+ }
else
- mUseButton->setCaption(_("Equip"));
- }
- else
- {
- mUseButton->setCaption(_("Use"));
+ {
+ mUseButton->setCaption(_("Use"));
+ }
}
updateDropButton();
@@ -674,8 +676,7 @@ void InventoryWindow::slotsChanged(Inventory *const inventory)
}
mSlotsBar->setText(strprintf("%d/%d", usedSlots, maxSlots));
- if (mItems)
- mItems->updateMatrix();
+ mItems->updateMatrix();
}
}
@@ -690,15 +691,12 @@ void InventoryWindow::updateDropButton()
}
else
{
- if (mItems)
- {
- const Item *const item = mItems->getSelectedItem();
+ const Item *const item = mItems->getSelectedItem();
- if (item && item->getQuantity() > 1)
- mDropButton->setCaption(_("Drop..."));
- else
- mDropButton->setCaption(_("Drop"));
- }
+ if (item && item->getQuantity() > 1)
+ mDropButton->setCaption(_("Drop..."));
+ else
+ mDropButton->setCaption(_("Drop"));
}
}