From fd050698f74b5dc7a9867bc93ba6b7c65ef2462f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 17 Sep 2014 10:55:20 +0300 Subject: Remove getter for inventoryHandler. --- src/gui/dialogsmanager.cpp | 4 ++-- src/gui/popups/popupmenu.cpp | 18 +++++++++--------- src/gui/widgets/itemcontainer.cpp | 4 ++-- src/gui/windows/inventorywindow.cpp | 16 ++++++++-------- src/gui/windows/itemamountwindow.cpp | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src/gui') diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index dd5cfee6e..6af34bef4 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -55,8 +55,8 @@ void DialogsManager::closeDialogs() BuySellDialog::closeAll(); NpcDialog::closeAll(); SellDialog::closeAll(); - if (Net::getInventoryHandler()) - Net::getInventoryHandler()->closeStorage(); + if (inventoryHandler) + inventoryHandler->closeStorage(); if (deathNotice) { deathNotice->scheduleDelete(); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 8e9939991..1c4722419 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1191,25 +1191,25 @@ void PopupMenu::handleLink(const std::string &link, int cnt = 10; if (cnt > mItem->getQuantity()) cnt = mItem->getQuantity(); - Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, + inventoryHandler->moveItem2(Inventory::INVENTORY, mItem->getInvIndex(), cnt, Inventory::STORAGE); } else if (link == "store half" && mItem) { - Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, + inventoryHandler->moveItem2(Inventory::INVENTORY, mItem->getInvIndex(), mItem->getQuantity() / 2, Inventory::STORAGE); } else if (link == "store all-1" && mItem) { - Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, + inventoryHandler->moveItem2(Inventory::INVENTORY, mItem->getInvIndex(), mItem->getQuantity() - 1, Inventory::STORAGE); } else if (link == "store all" && mItem) { - Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, + inventoryHandler->moveItem2(Inventory::INVENTORY, mItem->getInvIndex(), mItem->getQuantity(), Inventory::STORAGE); } @@ -1259,25 +1259,25 @@ void PopupMenu::handleLink(const std::string &link, int cnt = 10; if (cnt > mItem->getQuantity()) cnt = mItem->getQuantity(); - Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, + inventoryHandler->moveItem2(Inventory::STORAGE, mItem->getInvIndex(), cnt, Inventory::INVENTORY); } else if (link == "retrieve half" && mItem) { - Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, + inventoryHandler->moveItem2(Inventory::STORAGE, mItem->getInvIndex(), mItem->getQuantity() / 2, Inventory::INVENTORY); } else if (link == "retrieve all-1" && mItem) { - Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, + inventoryHandler->moveItem2(Inventory::STORAGE, mItem->getInvIndex(), mItem->getQuantity() - 1, Inventory::INVENTORY); } else if (link == "retrieve all" && mItem) { - Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, + inventoryHandler->moveItem2(Inventory::STORAGE, mItem->getInvIndex(), mItem->getQuantity(), Inventory::INVENTORY); } @@ -2856,7 +2856,7 @@ void PopupMenu::addUseDrop(const Item *const item, const bool isProtected) } } - if (Net::getInventoryHandler()->canSplit(item)) + if (inventoryHandler->canSplit(item)) { // TRANSLATORS: popup menu item // TRANSLATORS: split items diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index d3a57a71b..aa8966620 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -497,7 +497,7 @@ void ItemContainer::mouseReleased(MouseEvent &event) return; if (index == mSelectedIndex || mSelectedIndex == -1) return; - Net::getInventoryHandler()->moveItem(mSelectedIndex, index); + inventoryHandler->moveItem(mSelectedIndex, index); selectNone(); } else if (mInventory) @@ -570,7 +570,7 @@ void ItemContainer::mouseReleased(MouseEvent &event) { if (srcContainer != -1) { // inventory <--> storage - Net::getInventoryHandler()->moveItem2(srcContainer, + inventoryHandler->moveItem2(srcContainer, item->getInvIndex(), item->getQuantity(), dstContainer); } diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index c1bdafe7b..e44f9e087 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -369,7 +369,7 @@ void InventoryWindow::action(const ActionEvent &event) { if (isStorageActive()) { - Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, + inventoryHandler->moveItem2(Inventory::INVENTORY, item->getInvIndex(), item->getQuantity(), Inventory::STORAGE); } @@ -474,7 +474,7 @@ void InventoryWindow::mouseClicked(MouseEvent &event) } else { - Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, + inventoryHandler->moveItem2(Inventory::INVENTORY, item->getInvIndex(), item->getQuantity(), Inventory::STORAGE); } @@ -488,7 +488,7 @@ void InventoryWindow::mouseClicked(MouseEvent &event) } else { - Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, + inventoryHandler->moveItem2(Inventory::STORAGE, item->getInvIndex(), item->getQuantity(), Inventory::INVENTORY); } @@ -588,7 +588,7 @@ void InventoryWindow::valueChanged(const SelectionEvent &event A_UNUSED) Item *const item = mItems->getSelectedItem(); - if (mSplit && item && Net::getInventoryHandler()-> + if (mSplit && item && inventoryHandler-> canSplit(mItems->getSelectedItem())) { ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, @@ -642,7 +642,7 @@ void InventoryWindow::updateButtons(const Item *item) if (mSplitButton) { - if (Net::getInventoryHandler()->canSplit(item)) + if (inventoryHandler->canSplit(item)) mSplitButton->setEnabled(true); else mSplitButton->setEnabled(false); @@ -663,10 +663,10 @@ void InventoryWindow::close() } else { - if (Net::getInventoryHandler()) + if (inventoryHandler) { - Net::getInventoryHandler()->closeStorage(Inventory::STORAGE); - Net::getInventoryHandler()->forgotStorage(); + inventoryHandler->closeStorage(Inventory::STORAGE); + inventoryHandler->forgotStorage(); } scheduleDelete(); } diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index d7760444a..86cfd973c 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -67,14 +67,14 @@ void ItemAmountWindow::finish(const Item *const item, PlayerInfo::dropItem(item, amount, true); break; case ItemSplit: - Net::getInventoryHandler()->splitItem(item, amount); + inventoryHandler->splitItem(item, amount); break; case StoreAdd: - Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, + inventoryHandler->moveItem2(Inventory::INVENTORY, item->getInvIndex(), amount, Inventory::STORAGE); break; case StoreRemove: - Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, + inventoryHandler->moveItem2(Inventory::STORAGE, item->getInvIndex(), amount, Inventory::INVENTORY); break; case ShopBuyAdd: -- cgit v1.2.3-60-g2f50