diff options
author | jak1 <mike.wollmann@gmail.com> | 2020-11-03 12:00:11 +0100 |
---|---|---|
committer | jak1 <mike.wollmann@gmail.com> | 2021-03-12 04:00:56 +0000 |
commit | e580ef08d69268ee53cca8a91949adf436e800cc (patch) | |
tree | 6b431d53df1aa237e916bae0b50948d3eedd5c5f /src/gui | |
parent | a0be82a48061d37c0c23cba48f4d268a052af598 (diff) | |
download | plus-e580ef08d69268ee53cca8a91949adf436e800cc.tar.gz plus-e580ef08d69268ee53cca8a91949adf436e800cc.tar.bz2 plus-e580ef08d69268ee53cca8a91949adf436e800cc.tar.xz plus-e580ef08d69268ee53cca8a91949adf436e800cc.zip |
added 'store all' button shown: when in storage window
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 31 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.h | 1 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 28d83b10f..f86410a8c 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -98,6 +98,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mCartButton(nullptr), mEquipmentButton(nullptr), mStoreButton(nullptr), + mStoreAllButton(nullptr), mRetrieveButton(nullptr), mInvCloseButton(nullptr), mWeightBar(nullptr), @@ -231,6 +232,12 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : "drop", BUTTON_SKIN, this); + mStoreAllButton = new Button(this, + // TRANSLATORS: storage button + _("Store all"), + "storeall", + BUTTON_SKIN, + this); mOutfitButton = new Button(this, // TRANSLATORS: inventory outfits button _("O"), @@ -280,6 +287,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : place(0, 2, invenScroll, 11, 1).setPadding(3); place(0, 3, mUseButton, 1, 1); place(1, 3, mDropButton, 1, 1); + place(2, 3, mStoreAllButton, 1, 1); + ContainerPlacer placer = getPlacer(10, 3); placer(0, 0, mShopButton, 1, 1); placer(1, 0, mOutfitButton, 1, 1); @@ -503,6 +512,22 @@ void InventoryWindow::action(const ActionEvent &event) 0); } } + else if (eventId == "storeall") + { + if (storageWindow != nullptr) + { + for (int i = 0; i < mInventory->getNumberOfSlotsUsed(); i++) + { + Item *const item = mInventory->getItem(i); + if (item == nullptr) + continue; + inventoryHandler->moveItem2(InventoryType::Inventory, + item->getInvIndex(), + item->getQuantity(), + InventoryType::Storage); + } + } + } else if (eventId == "sort") { mItems->setSortType(mSortDropDown->getSelected()); @@ -520,7 +545,6 @@ void InventoryWindow::action(const ActionEvent &event) mItems->setFilter(ItemDB::getTagId(tagName)); return; } - Item *const item = mItems->getSelectedItem(); if (item == nullptr) @@ -984,8 +1008,13 @@ void InventoryWindow::updateDropButton() // TRANSLATORS: inventory button mDropButton->setCaption(_("Store")); } + if (isStorageActive()) + { + mStoreAllButton->setVisible(Visible_true); + } else { + mStoreAllButton->setVisible(Visible_false); const Item *const item = mItems->getSelectedItem(); if ((item != nullptr) && item->getQuantity() > 1) { diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index 2f1baf356..2da114185 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -189,6 +189,7 @@ class InventoryWindow final : public Window, Button *mCartButton; Button *mEquipmentButton; Button *mStoreButton; + Button *mStoreAllButton; Button *mRetrieveButton; Button *mInvCloseButton; |