diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-04 19:46:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-04 19:46:32 +0300 |
commit | 9dea4b4a5d4df935cca5a44b16e7e78d5a9d9117 (patch) | |
tree | ec210d7f19726150d7e3acbe3b1e7b2c83cead2c /src | |
parent | 11af049539ec6b5aed7e956e7a23aeb79746c536 (diff) | |
download | plus-9dea4b4a5d4df935cca5a44b16e7e78d5a9d9117.tar.gz plus-9dea4b4a5d4df935cca5a44b16e7e78d5a9d9117.tar.bz2 plus-9dea4b4a5d4df935cca5a44b16e7e78d5a9d9117.tar.xz plus-9dea4b4a5d4df935cca5a44b16e7e78d5a9d9117.zip |
in drag and drop not allow give to npc or move to trade protected items.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
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()); + } } } } |