diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/gui/item_amount.cpp | 7 |
2 files changed, 9 insertions, 5 deletions
@@ -1,4 +1,9 @@ -2006-05-13 Bjørn Lindeijer <bjorn@lindeijer.nl> +2006-05-15 Björn Steinbrink <B.Steinbrink@gmx.de> + + * src/gui/item_amount.cpp: Set slider range to the real values instead + of mapping the amount between [0,1] and [1,max] all the time. + +2006-05-13 Bjørn Lindeijer <bjorn@lindeijer.nl> * src/openglgraphics.cpp: Set color back to current color instead of setting it to white. Fixes white rectangles in equipment window. 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); } |