From c305c76f82d832cb3db9e1edb805d24522a90c3f Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 5 May 2009 20:58:21 -0600 Subject: Change the item amount window to skip on one item --- src/gui/itemamount.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp index b3089e34..46d12ee5 100644 --- a/src/gui/itemamount.cpp +++ b/src/gui/itemamount.cpp @@ -70,6 +70,14 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item, minusButton->adjustSize(); minusButton->setWidth(plusButton->getWidth()); + // If only one item is available, then the window isn't needed, so move on + // To prevent problems, we still build the gui elements + if (mMax <= 1) + { + action(gcn::ActionEvent(this, "All")); + return; + } + // Set positions ContainerPlacer place; place = getPlacer(0, 0); @@ -151,14 +159,13 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event) case ItemSplit: player_node->splitItem(mItem, amount); break; -#else +#endif case StoreAdd: storageWindow->addStore(mItem, amount); break; case StoreRemove: storageWindow->removeStore(mItem, amount); break; -#endif default: return; break; -- cgit v1.2.3-70-g09d2