diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-04-07 13:49:18 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-04-07 13:49:18 +0000 |
commit | 112fbe319f1e9070e9b6b62a7ec12d625a19be51 (patch) | |
tree | 62572ba750a8fb8d37d2f63a69f282d8590f4c31 /src/gui/buy.cpp | |
parent | 682be63061b2134cd3bc8b272fd3180e82437bb9 (diff) | |
download | mana-112fbe319f1e9070e9b6b62a7ec12d625a19be51.tar.gz mana-112fbe319f1e9070e9b6b62a7ec12d625a19be51.tar.bz2 mana-112fbe319f1e9070e9b6b62a7ec12d625a19be51.tar.xz mana-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/buy.cpp')
-rw-r--r-- | src/gui/buy.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index e75bdbb1..2da38c36 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -42,6 +42,7 @@ BuyDialog::BuyDialog(): moneyLabel = new gcn::Label("350 G"); okButton = new Button("OK"); cancelButton = new Button("Cancel"); + okButton->setEnabled(false); setContentSize(260, 175); scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110)); @@ -121,11 +122,17 @@ void BuyDialog::action(const std::string& eventId) if (eventId == "slider" || eventId == "item") { if (selectedItem > -1) { int maxItems = money / shopInventory[selectedItem].price; + 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") { |