From 51c1436f27042c1a84aa3d18aa500385abc7f57b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 23 Dec 2017 06:35:15 +0300 Subject: Remove default parameters from itemamountwindow. --- src/gui/widgets/itemcontainer.cpp | 4 ++- src/gui/widgets/shoplistbox.cpp | 8 +++-- src/gui/windows/inventorywindow.cpp | 64 ++++++++++++++++++++++++++-------- src/gui/windows/itemamountwindow.h | 6 ++-- src/gui/windows/maileditwindow.cpp | 5 ++- src/gui/windows/shopwindow.cpp | 6 ++-- src/gui/windows/tradewindow.cpp | 5 ++- src/progs/manaplus/actions/actions.cpp | 25 ++++++++++--- 8 files changed, 94 insertions(+), 29 deletions(-) diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index b6ac3cff3..6b073f741 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -890,7 +890,9 @@ void ItemContainer::mouseReleased(MouseEvent &event) ItemAmountWindow::showWindow( ItemAmountWindowUsage::MailAdd, mailEditWindow, - item); + item, + 0, + 0); } else { diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 3df46b854..ea3f46e87 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -273,14 +273,18 @@ void ShopListBox::mouseReleased(MouseEvent& event) ItemAmountWindow::showWindow( ItemAmountWindowUsage::ShopBuyAdd, nullptr, - item); + item, + 0, + 0); } else { ItemAmountWindow::showWindow( ItemAmountWindowUsage::ShopSellAdd, nullptr, - item); + item, + 0, + 0); } } diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index aca7c583a..3a62686ce 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -440,12 +440,18 @@ void InventoryWindow::action(const ActionEvent &event) if (storageWindow != nullptr) { ItemAmountWindow::showWindow(ItemAmountWindowUsage::StoreAdd, - this, item); + this, + item, + 0, + 0); } else if ((cartWindow != nullptr) && cartWindow->isWindowVisible()) { ItemAmountWindow::showWindow(ItemAmountWindowUsage::CartAdd, - this, item); + this, + item, + 0, + 0); } } else if (eventId == "sort") @@ -507,27 +513,38 @@ void InventoryWindow::action(const ActionEvent &event) else { ItemAmountWindow::showWindow(ItemAmountWindowUsage::ItemDrop, - this, item); + this, + item, + 0, + 0); } } } else if (eventId == "split") { ItemAmountWindow::showWindow(ItemAmountWindowUsage::ItemSplit, - this, item, - (item->getQuantity() - 1)); + this, + item, + item->getQuantity() - 1, + 9); } else if (eventId == "retrieve") { if (storageWindow != nullptr) { ItemAmountWindow::showWindow(ItemAmountWindowUsage::StoreRemove, - this, item); + this, + item, + 0, + 0); } else if ((cartWindow != nullptr) && cartWindow->isWindowVisible()) { ItemAmountWindow::showWindow(ItemAmountWindowUsage::CartRemove, - this, item); + this, + item, + 0, + 0); } } } @@ -611,7 +628,9 @@ void InventoryWindow::mouseClicked(MouseEvent &event) ItemAmountWindow::showWindow( ItemAmountWindowUsage::StoreAdd, inventoryWindow, - item); + item, + 0, + 0); } else { @@ -628,7 +647,9 @@ void InventoryWindow::mouseClicked(MouseEvent &event) ItemAmountWindow::showWindow( ItemAmountWindowUsage::StoreRemove, inventoryWindow, - item); + item, + 0, + 0); } else { @@ -646,7 +667,10 @@ void InventoryWindow::mouseClicked(MouseEvent &event) if (event.getButton() == MouseButton::RIGHT) { ItemAmountWindow::showWindow(ItemAmountWindowUsage::TradeAdd, - tradeWindow, item); + tradeWindow, + item, + 0, + 0); } else { @@ -662,7 +686,10 @@ void InventoryWindow::mouseClicked(MouseEvent &event) { ItemAmountWindow::showWindow( ItemAmountWindowUsage::StoreAdd, - inventoryWindow, item); + inventoryWindow, + item, + 0, + 0); } else if (tradeWindow != nullptr && tradeWindow->isWindowVisible()) @@ -671,7 +698,10 @@ void InventoryWindow::mouseClicked(MouseEvent &event) return; ItemAmountWindow::showWindow( ItemAmountWindowUsage::TradeAdd, - tradeWindow, item); + tradeWindow, + item, + 0, + 0); } else { @@ -684,7 +714,10 @@ void InventoryWindow::mouseClicked(MouseEvent &event) { ItemAmountWindow::showWindow( ItemAmountWindowUsage::StoreRemove, - inventoryWindow, item); + inventoryWindow, + item, + 0, + 0); } } } @@ -755,7 +788,10 @@ void InventoryWindow::valueChanged(const SelectionEvent &event A_UNUSED) canSplit(mItems->getSelectedItem())) { ItemAmountWindow::showWindow(ItemAmountWindowUsage::ItemSplit, - this, item, item->getQuantity() - 1); + this, + item, + item->getQuantity() - 1, + 0); } updateButtons(item); } diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h index 97f539ac9..ca0bd4955 100644 --- a/src/gui/windows/itemamountwindow.h +++ b/src/gui/windows/itemamountwindow.h @@ -80,8 +80,8 @@ class ItemAmountWindow final : public Window, static void showWindow(const ItemAmountWindowUsageT usage, Window *const parent, Item *const item, - int maxRange = 0, - const int tag = 0); + int maxRange, + const int tag); ~ItemAmountWindow(); @@ -96,7 +96,7 @@ class ItemAmountWindow final : public Window, ItemAmountWindow(const ItemAmountWindowUsageT usage, Window *const parent, Item *const item, - const int maxRange = 0); + const int maxRange); /**< Item amount caption. */ IntTextField *mItemAmountTextField A_NONNULLPOINTER; diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp index a47b284de..5c7b8efec 100644 --- a/src/gui/windows/maileditwindow.cpp +++ b/src/gui/windows/maileditwindow.cpp @@ -151,7 +151,10 @@ void MailEditWindow::action(const ActionEvent &event) return; ItemAmountWindow::showWindow(ItemAmountWindowUsage::MailAdd, - this, item); + this, + item, + 0, + 0); } } diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 757ffd902..d3b37b039 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -399,7 +399,8 @@ void ShopWindow::action(const ActionEvent &event) ItemAmountWindow::showWindow(ItemAmountWindowUsage::ShopBuyAdd, this, item, - sumAmount(item)); + sumAmount(item), + 0); } else { @@ -407,7 +408,8 @@ void ShopWindow::action(const ActionEvent &event) ItemAmountWindowUsage::ShopSellAdd, this, item, - sumAmount(item)); + sumAmount(item), + 0); } } } diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index d6b39e8f1..413945660 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -399,7 +399,10 @@ void TradeWindow::action(const ActionEvent &event) // Choose amount of items to trade ItemAmountWindow::showWindow(ItemAmountWindowUsage::TradeAdd, - this, item); + this, + item, + 0, + 0); setStatus(PREPARING); } diff --git a/src/progs/manaplus/actions/actions.cpp b/src/progs/manaplus/actions/actions.cpp index f74cc681a..64512517b 100644 --- a/src/progs/manaplus/actions/actions.cpp +++ b/src/progs/manaplus/actions/actions.cpp @@ -473,7 +473,10 @@ impHandler(dropItemId) if ((item != nullptr) && !PlayerInfo::isItemProtected(item->getId())) { ItemAmountWindow::showWindow(ItemAmountWindowUsage::ItemDrop, - inventoryWindow, item); + inventoryWindow, + item, + 0, + 0); } return true; } @@ -485,7 +488,10 @@ impHandler(dropItemInv) if ((item != nullptr) && !PlayerInfo::isItemProtected(item->getId())) { ItemAmountWindow::showWindow(ItemAmountWindowUsage::ItemDrop, - inventoryWindow, item); + inventoryWindow, + item, + 0, + 0); } return true; } @@ -1752,7 +1758,10 @@ impHandler(invToStorage) else { ItemAmountWindow::showWindow(ItemAmountWindowUsage::StoreAdd, - inventoryWindow, item); + inventoryWindow, + item, + 0, + 0); } return true; } @@ -1773,7 +1782,10 @@ impHandler(tradeAdd) else { ItemAmountWindow::showWindow(ItemAmountWindowUsage::TradeAdd, - tradeWindow, item); + tradeWindow, + item, + 0, + 0); } return true; } @@ -1795,7 +1807,10 @@ impHandler(storageToInv) else { ItemAmountWindow::showWindow(ItemAmountWindowUsage::StoreRemove, - storageWindow, item); + storageWindow, + item, + 0, + 0); } return true; } -- cgit v1.2.3-70-g09d2