summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/itemcontainer.cpp19
-rw-r--r--src/gui/windows/npcdialog.cpp20
2 files changed, 3 insertions, 36 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 773f43ff7..8fc8b09e4 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -631,23 +631,8 @@ void ItemContainer::mouseReleased(MouseEvent &event)
inventory = PlayerInfo::getInventory();
if (inventory)
{
- const Item *const item = inventory->getItem(dragDrop.getTag());
- if (item && !PlayerInfo::isItemProtected(item->getId()))
- {
- const int index = mInventory->addItem(item->getId(),
- item->getType(),
- 1,
- 1,
- item->getColor(),
- item->getIdentified(),
- item->getDamaged(),
- item->getFavorite(),
- Equipm_false,
- Equipped_false);
- Item *const item2 = mInventory->getItem(index);
- if (item2)
- item2->setTag(item->getInvIndex());
- }
+ mInventory->addVirtualItem(inventory->getItem(
+ dragDrop.getTag()));
}
return;
}
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 51edbaf3b..5cc538e34 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -542,25 +542,7 @@ void NpcDialog::action(const ActionEvent &event)
else if (eventId == "add")
{
if (inventoryWindow)
- {
- const Item *const item = inventoryWindow->getSelectedItem();
- if (item)
- {
- const int index = mInventory->addItem(item->getId(),
- item->getType(),
- 1,
- 1,
- item->getColor(),
- item->getIdentified(),
- item->getDamaged(),
- item->getFavorite(),
- Equipm_false,
- Equipped_false);
- Item *const item2 = mInventory->getItem(index);
- if (item2)
- item2->setTag(item->getInvIndex());
- }
- }
+ mInventory->addVirtualItem(inventoryWindow->getSelectedItem());
}
else if (eventId.find("skin_") == 0)
{