summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-11 11:40:12 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-11 15:02:25 +0300
commit5001fa194c820422dd5de2dd655c17bde131e1cb (patch)
tree0f8b0ad59277055c0f94591f64a1367bba558cca /src/gui/widgets
parent51a4bf586930fee4df788bef5b6cc350e10cc005 (diff)
downloadmanaplus-5001fa194c820422dd5de2dd655c17bde131e1cb.tar.gz
manaplus-5001fa194c820422dd5de2dd655c17bde131e1cb.tar.bz2
manaplus-5001fa194c820422dd5de2dd655c17bde131e1cb.tar.xz
manaplus-5001fa194c820422dd5de2dd655c17bde131e1cb.zip
add support for giving item to npc (evol only)
chancge network version to 9.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/itemcontainer.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index e815b1541..f3fb21336 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -413,6 +413,8 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
case Inventory::TRADE:
src = DRAGDROP_SOURCE_TRADE;
break;
+ case Inventory::NPC:
+ src = DRAGDROP_SOURCE_NPC;
default:
break;
}
@@ -505,6 +507,9 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event)
case Inventory::TRADE:
dst = DRAGDROP_SOURCE_TRADE;
break;
+ case Inventory::NPC:
+ dst = DRAGDROP_SOURCE_NPC;
+ break;
default:
break;
}
@@ -530,6 +535,23 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event)
{
inventory = PlayerInfo::getInventory();
}
+ else if (src == DRAGDROP_SOURCE_INVENTORY
+ && dst == DRAGDROP_SOURCE_NPC)
+ {
+ inventory = PlayerInfo::getInventory();
+ const Item *const item = inventory->getItem(dragDrop.getTag());
+ if (item)
+ mInventory->addItem(item->getId(), 1, 1, item->getColor());
+ return;
+ }
+ else if (src == DRAGDROP_SOURCE_NPC)
+ {
+ inventory = PlayerInfo::getInventory();
+ const Item *const item = inventory->getItem(dragDrop.getTag());
+ if (item)
+ mInventory->removeItemAt(dragDrop.getTag());
+ return;
+ }
if (inventory)
{