diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-05-15 21:03:22 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-05-15 21:03:22 +0000 |
commit | 2b528cc71c56a01fefe95e48373d3c101ce6307a (patch) | |
tree | 80a243df67d9041891f3fe6948fb0feff24fc9da /src/gui | |
parent | b1b8bdc56839540492c409f7d98923c85369a478 (diff) | |
download | mana-client-2b528cc71c56a01fefe95e48373d3c101ce6307a.tar.gz mana-client-2b528cc71c56a01fefe95e48373d3c101ce6307a.tar.bz2 mana-client-2b528cc71c56a01fefe95e48373d3c101ce6307a.tar.xz mana-client-2b528cc71c56a01fefe95e48373d3c101ce6307a.zip |
Set slider range to the real values instead of mapping the amount between [0,1] and [1,max] all the time.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/item_amount.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp index 8c66144b..b1b01c3f 100644 --- a/src/gui/item_amount.cpp +++ b/src/gui/item_amount.cpp @@ -43,7 +43,7 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item): Button *plusButton = new Button("+", "Plus", this); Button *okButton = new Button("Okay", "Drop", this); Button *cancelButton = new Button("Cancel", "Cancel", this); - mItemAmountSlide = new Slider(1.0); + mItemAmountSlide = new Slider(1.0, mItem->getQuantity()); mItemAmountTextBox->setRange(1, mItem->getQuantity()); mItemAmountSlide->setDimension(gcn::Rectangle(5, 120, 180, 10)); @@ -122,10 +122,9 @@ void ItemAmountWindow::action(const std::string& eventId) } else if (eventId == "Slide") { - amount = (int)(mItemAmountSlide->getValue()*(mItem->getQuantity()+1)); + amount = static_cast<int>(mItemAmountSlide->getValue()); } mItemAmountTextBox->setInt(amount); - amount = mItemAmountTextBox->getInt(); // The textbox cares about bounds - mItemAmountSlide->setValue((amount-1)*1.0f/(mItem->getQuantity()-1)); + mItemAmountSlide->setValue(amount); } |