From ce6238dcc772ec901291c5f1dc5e57b89a0a2fc4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 19 May 2013 20:12:20 +0300 Subject: improve selldialog class. --- src/gui/selldialog.cpp | 12 ++++-------- src/gui/selldialog.h | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp index 82d79104a..8006355bc 100644 --- a/src/gui/selldialog.cpp +++ b/src/gui/selldialog.cpp @@ -151,7 +151,6 @@ SellDialog::~SellDialog() { delete mShopItems; mShopItems = nullptr; - instances.remove(this); } @@ -159,10 +158,7 @@ void SellDialog::reset() { mShopItems->clear(); mSlider->setValue(0); - - // Reset previous selected item to prevent failing asserts mShopItemList->setSelected(-1); - updateButtonsAndLabels(); } @@ -234,12 +230,13 @@ void SellDialog::action(const gcn::ActionEvent &event) { if (eventId == "presell") { - ShopItem *const item = mShopItems->at(selectedItem); + const ShopItem *const item = mShopItems->at(selectedItem); const ItemInfo &info = ItemDB::get(item->getId()); if (info.isProtected()) { - // TRANSLATORS: sell confirmation header - ConfirmDialog *dialog = new ConfirmDialog(_("sell item"), + ConfirmDialog *const dialog = new ConfirmDialog( + // TRANSLATORS: sell confirmation header + _("sell item"), // TRANSLATORS: sell confirmation message strprintf(_("Do you really want to sell %s?"), info.getName().c_str()), false, true); @@ -292,7 +289,6 @@ void SellDialog::action(const gcn::ActionEvent &event) else { ShopItem *const item = mShopItems->at(selectedItem); - Net::getBuySellHandler()->sendSellRequest(mNick, item, mAmountItems); diff --git a/src/gui/selldialog.h b/src/gui/selldialog.h index 2002c67e4..91dcf74c8 100644 --- a/src/gui/selldialog.h +++ b/src/gui/selldialog.h @@ -99,7 +99,7 @@ class SellDialog final : public Window, /** * Sets the visibility of this window. */ - void setVisible(bool visible); + void setVisible(bool visible) override; void addItem(const int id, const unsigned char color, const int amount, const int price); -- cgit v1.2.3-70-g09d2