summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-15 19:00:10 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-15 19:00:10 +0300
commit3216d6caf93ebdb24bee3d9a859ea9e562d8ff4d (patch)
tree45a6fc90339ac63f4af1c282baa5875bf3d890cb /src/gui
parentf03dfb3f143ee10329a10d093d6d31c1ab480007 (diff)
downloadmanaplus-3216d6caf93ebdb24bee3d9a859ea9e562d8ff4d.tar.gz
manaplus-3216d6caf93ebdb24bee3d9a859ea9e562d8ff4d.tar.bz2
manaplus-3216d6caf93ebdb24bee3d9a859ea9e562d8ff4d.tar.xz
manaplus-3216d6caf93ebdb24bee3d9a859ea9e562d8ff4d.zip
add item option what can prevent sell item to npc without confirmation.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/selldialog.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index 5963d8dff..82d79104a 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -25,6 +25,7 @@
#include "shopitem.h"
#include "units.h"
+#include "gui/confirmdialog.h"
#include "gui/setup.h"
#include "gui/tradewindow.h"
@@ -99,7 +100,7 @@ void SellDialog::init()
// TRANSLATORS: sell dialog button
mDecreaseButton = new Button(this, _("-"), "dec", this);
// TRANSLATORS: sell dialog button
- mSellButton = new Button(this, _("Sell"), "sell", this);
+ mSellButton = new Button(this, _("Sell"), "presell", this);
// TRANSLATORS: sell dialog button
mQuitButton = new Button(this, _("Quit"), "quit", this);
// TRANSLATORS: sell dialog button
@@ -226,11 +227,26 @@ void SellDialog::action(const gcn::ActionEvent &event)
mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
- else if (eventId == "sell" && mAmountItems > 0
- && mAmountItems <= mMaxItems)
+ else if ((eventId == "presell" || eventId == "sell" || eventId == "yes")
+ && mAmountItems > 0 && mAmountItems <= mMaxItems)
{
if (mNpcId != -1)
{
+ if (eventId == "presell")
+ {
+ 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"),
+ // TRANSLATORS: sell confirmation message
+ strprintf(_("Do you really want to sell %s?"),
+ info.getName().c_str()), false, true);
+ dialog->addActionListener(this);
+ return;
+ }
+ }
// Attempt sell
ShopItem *const item = mShopItems->at(selectedItem);
mPlayerMoney +=