summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-07 17:18:14 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-07 17:18:14 +0300
commitcc4ac1e1884378e861efd577507a28ae668156f1 (patch)
tree258ce3fa49750098f1b2ddfdbb68041089469b0c
parentd4e1c1003970749f9280e3b94d2d351371134101 (diff)
downloadmanaverse-cc4ac1e1884378e861efd577507a28ae668156f1.tar.gz
manaverse-cc4ac1e1884378e861efd577507a28ae668156f1.tar.bz2
manaverse-cc4ac1e1884378e861efd577507a28ae668156f1.tar.xz
manaverse-cc4ac1e1884378e861efd577507a28ae668156f1.zip
improve inventorywindow class.
-rw-r--r--src/gui/inventorywindow.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 6ff6506b3..11c15a012 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -80,10 +80,10 @@ public:
virtual ~SortListModelInv()
{ }
- virtual int getNumberOfElements()
+ virtual int getNumberOfElements() override
{ return 6; }
- virtual std::string getElementAt(int i)
+ virtual std::string getElementAt(int i) override
{
if (i >= getNumberOfElements() || i < 0)
return "???";
@@ -173,14 +173,14 @@ InventoryWindow::InventoryWindow(Inventory *const inventory):
if (isMainInventory())
{
// TRANSLATORS: inventory button
- std::string equip = _("Equip");
+ const std::string equip = _("Equip");
// TRANSLATORS: inventory button
- std::string use = _("Use");
+ const std::string use = _("Use");
// TRANSLATORS: inventory button
- std::string unequip = _("Unequip");
+ const std::string unequip = _("Unequip");
std::string longestUseString = getFont()->getWidth(equip) >
- getFont()->getWidth(use) ? equip : use;
+ getFont()->getWidth(use) ? equip : use;
if (getFont()->getWidth(longestUseString) <
getFont()->getWidth(unequip))
@@ -577,8 +577,8 @@ void InventoryWindow::valueChanged(const gcn::SelectionEvent &event A_UNUSED)
if (mSplit && item && Net::getInventoryHandler()->
canSplit(mItems->getSelectedItem()))
{
- ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item,
- (item->getQuantity() - 1));
+ ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit,
+ this, item, item->getQuantity() - 1);
}
updateButtons(item);
}
@@ -655,7 +655,8 @@ void InventoryWindow::close()
}
else
{
- Net::getInventoryHandler()->closeStorage(Inventory::STORAGE);
+ if (Net::getInventoryHandler())
+ Net::getInventoryHandler()->closeStorage(Inventory::STORAGE);
scheduleDelete();
}
}
@@ -720,7 +721,6 @@ void InventoryWindow::updateDropButton()
else
{
const Item *const item = mItems->getSelectedItem();
-
if (item && item->getQuantity() > 1)
{
// TRANSLATORS: inventory button