From 4c57a567eec8b3df0b0009b5520d647cccb83338 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 23 Jun 2013 12:21:55 +0300 Subject: Add support for protecting items. Protected item cant be selled, traded, dropped, used. Protect/unprotect item can be from context menu. --- src/gui/selldialog.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gui/selldialog.cpp') diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp index 8006355bc..c61dec541 100644 --- a/src/gui/selldialog.cpp +++ b/src/gui/selldialog.cpp @@ -22,6 +22,7 @@ #include "gui/selldialog.h" +#include "playerinfo.h" #include "shopitem.h" #include "units.h" @@ -228,9 +229,11 @@ void SellDialog::action(const gcn::ActionEvent &event) { if (mNpcId != -1) { + ShopItem *const item = mShopItems->at(selectedItem); + if (PlayerInfo::isItemProtected(item->getId())) + return; if (eventId == "presell") { - const ShopItem *const item = mShopItems->at(selectedItem); const ItemInfo &info = ItemDB::get(item->getId()); if (info.isProtected()) { @@ -245,7 +248,6 @@ void SellDialog::action(const gcn::ActionEvent &event) } } // Attempt sell - ShopItem *const item = mShopItems->at(selectedItem); mPlayerMoney += mAmountItems * mShopItems->at(selectedItem)->getPrice(); mMaxItems -= mAmountItems; -- cgit v1.2.3-60-g2f50