diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-08 23:18:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-08 23:18:03 +0300 |
commit | 7380aa6e86b51ef62530bea5d6f6f63244dffc4a (patch) | |
tree | 1b9915284b2b9c3e0969ae05f54a53adba72e527 /src/gui/windows/inventorywindow.cpp | |
parent | 7e66a4606bb15d98197f71245fe191d03152ee5f (diff) | |
download | plus-7380aa6e86b51ef62530bea5d6f6f63244dffc4a.tar.gz plus-7380aa6e86b51ef62530bea5d6f6f63244dffc4a.tar.bz2 plus-7380aa6e86b51ef62530bea5d6f6f63244dffc4a.tar.xz plus-7380aa6e86b51ef62530bea5d6f6f63244dffc4a.zip |
Add some missing checks and remove useless checks.
Diffstat (limited to 'src/gui/windows/inventorywindow.cpp')
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index e21299583..5c6ae3faa 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -572,28 +572,32 @@ void InventoryWindow::mouseClicked(MouseEvent &event) tradeWindow->isWindowVisible() && inputManager.isActionActive(InputAction::STOP_ATTACK)); - if (!mod && !mod2 && event.getButton() == MouseButton::RIGHT) + if (mInventory) { - Item *const item = mItems->getSelectedItem(); + if (!mod && !mod2 && event.getButton() == MouseButton::RIGHT) + { + Item *const item = mItems->getSelectedItem(); - if (!item) - return; + if (!item) + return; - /* Convert relative to the window coordinates to absolute screen - * coordinates. - */ - const int mx = event.getX() + getX(); - const int my = event.getY() + getY(); + /* Convert relative to the window coordinates to absolute screen + * coordinates. + */ + const int mx = event.getX() + getX(); + const int my = event.getY() + getY(); - if (popupMenu) - popupMenu->showPopup(this, mx, my, item, mInventory->getType()); + if (popupMenu) + popupMenu->showPopup(this, mx, my, item, mInventory->getType()); + } } - - if (!mInventory) + else + { return; + } - if (event.getButton() == MouseButton::LEFT - || event.getButton() == MouseButton::RIGHT) + if (event.getButton() == MouseButton::LEFT || + event.getButton() == MouseButton::RIGHT) { Item *const item = mItems->getSelectedItem(); |