diff options
-rw-r--r-- | src/gui/windows/itemamountwindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/itemamountwindow.h | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 7ad559c92..0c0f0bfe2 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -156,10 +156,8 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, mEnabledKeyboard(keyboard.isEnabled()) { if (!mItem) - { - setVisible(false); return; - } + if (usage == ShopBuyAdd) mMax = 10000; else if (!mMax) @@ -297,11 +295,15 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, } setLocationRelativeTo(getParentWindow()); - setVisible(true); mItemIcon->addMouseListener(this); } +void ItemAmountWindow::postInit() +{ + setVisible(mItem); +} + ItemAmountWindow::~ItemAmountWindow() { delete mItemPopup; @@ -448,5 +450,5 @@ void ItemAmountWindow::showWindow(const Usage usage, Window *const parent, if (usage != ShopBuyAdd && usage != ShopSellAdd && maxRange <= 1) finish(item, maxRange, 0, usage); else - new ItemAmountWindow(usage, parent, item, maxRange); + (new ItemAmountWindow(usage, parent, item, maxRange))->postInit(); } diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h index 2e741a6cd..45d0d6b83 100644 --- a/src/gui/windows/itemamountwindow.h +++ b/src/gui/windows/itemamountwindow.h @@ -60,6 +60,8 @@ class ItemAmountWindow final : public Window, A_DELETE_COPY(ItemAmountWindow) + void postInit(); + /** * Called when receiving actions from widget. */ |