summaryrefslogtreecommitdiff
path: root/src/gui/sell.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-07 13:49:18 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-07 13:49:18 +0000
commit112fbe319f1e9070e9b6b62a7ec12d625a19be51 (patch)
tree62572ba750a8fb8d37d2f63a69f282d8590f4c31 /src/gui/sell.cpp
parent682be63061b2134cd3bc8b272fd3180e82437bb9 (diff)
downloadmana-client-112fbe319f1e9070e9b6b62a7ec12d625a19be51.tar.gz
mana-client-112fbe319f1e9070e9b6b62a7ec12d625a19be51.tar.bz2
mana-client-112fbe319f1e9070e9b6b62a7ec12d625a19be51.tar.xz
mana-client-112fbe319f1e9070e9b6b62a7ec12d625a19be51.zip
* Fixed crash on exit when trying to delete listbox that wasn't created.
* Disabled Ok button in Buy and Sell dialog when amount is 0 * Corrected the three known map bugs
Diffstat (limited to 'src/gui/sell.cpp')
-rw-r--r--src/gui/sell.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 4ab41cd2..d4bd1d8a 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -42,6 +42,7 @@ SellDialog::SellDialog():
quantityLabel = new gcn::Label("0");
okButton = new Button("OK");
cancelButton = new Button("Cancel");
+ okButton->setEnabled(false);
setContentSize(260, 175);
scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
@@ -114,11 +115,17 @@ void SellDialog::action(const std::string& eventId)
if (eventId == "slider" || eventId == "item") {
if (selectedItem > -1) {
int maxItems = shopInventory[selectedItem].quantity;
+ int numItems = (int)(slider->getValue() * maxItems);
std::stringstream ss;
- ss << (int)(slider->getValue() * maxItems);
+ ss << numItems;
quantityLabel->setCaption(ss.str());
quantityLabel->adjustSize();
+
+ okButton->setEnabled(numItems > 0);
+ }
+ else {
+ okButton->setEnabled(false);
}
}
else if (eventId == "ok") {