summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-24 23:08:40 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-24 23:08:40 +0300
commit50f4daf53d60cfb90107fd4989dd1869bc1f3e35 (patch)
treeb86638cb85d3845d5186563315dd5af5d8e15c50 /src/gui/widgets/itemcontainer.cpp
parentaf5fde1f88bd5c8d0e11b59d73f6c76610c14acf (diff)
downloadplus-50f4daf53d60cfb90107fd4989dd1869bc1f3e35.tar.gz
plus-50f4daf53d60cfb90107fd4989dd1869bc1f3e35.tar.bz2
plus-50f4daf53d60cfb90107fd4989dd1869bc1f3e35.tar.xz
plus-50f4daf53d60cfb90107fd4989dd1869bc1f3e35.zip
Add support for removing item from mail.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index f701ab6af..fd998180a 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -1019,12 +1019,28 @@ void ItemContainer::mouseReleased(MouseEvent &event)
}
else if (src == DragDropSource::Mail)
{
- inventory = PlayerInfo::getInventory();
- if (inventory != nullptr)
+ if (settings.enableNewMailSystem)
{
+ if (mailEditWindow == nullptr)
+ return;
+ inventory = mailEditWindow->getInventory();
+ if (inventory == nullptr)
+ return;
const Item *const item = inventory->getItem(dragDrop.getTag());
- if (item != nullptr)
- mInventory->removeItemAt(dragDrop.getTag());
+ if (item == nullptr)
+ return;
+ mail2Handler->removeItem(item->getTag(),
+ item->getQuantity());
+ }
+ else
+ {
+ inventory = PlayerInfo::getInventory();
+ if (inventory == nullptr)
+ return;
+ const Item *const item = inventory->getItem(dragDrop.getTag());
+ if (item == nullptr)
+ return;
+ mInventory->removeItemAt(dragDrop.getTag());
}
return;
}