From 9dea4b4a5d4df935cca5a44b16e7e78d5a9d9117 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 4 Oct 2013 19:46:32 +0300 Subject: in drag and drop not allow give to npc or move to trade protected items. --- src/gui/widgets/itemcontainer.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 32e179226..4cb7cbe89 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -528,6 +528,7 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event) } int srcContainer = -1; int dstContainer = -1; + bool checkProtection(false); Inventory *inventory = nullptr; if (src == DRAGDROP_SOURCE_INVENTORY && dst == DRAGDROP_SOURCE_STORAGE) @@ -546,6 +547,7 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event) if (src == DRAGDROP_SOURCE_INVENTORY && dst == DRAGDROP_SOURCE_TRADE) { + checkProtection = true; inventory = PlayerInfo::getInventory(); } else if (src == DRAGDROP_SOURCE_INVENTORY @@ -553,7 +555,7 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event) { inventory = PlayerInfo::getInventory(); const Item *const item = inventory->getItem(dragDrop.getTag()); - if (item) + if (item && !PlayerInfo::isItemProtected(item->getId())) mInventory->addItem(item->getId(), 1, 1, item->getColor()); return; } @@ -579,7 +581,12 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event) } else { // inventory --> trade - Net::getTradeHandler()->addItem(item, item->getQuantity()); + if (!checkProtection || !PlayerInfo::isItemProtected( + item->getId())) + { + Net::getTradeHandler()->addItem(item, + item->getQuantity()); + } } } } -- cgit v1.2.3-70-g09d2