diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-24 23:08:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-24 23:08:40 +0300 |
commit | 50f4daf53d60cfb90107fd4989dd1869bc1f3e35 (patch) | |
tree | b86638cb85d3845d5186563315dd5af5d8e15c50 /src/gui/widgets | |
parent | af5fde1f88bd5c8d0e11b59d73f6c76610c14acf (diff) | |
download | mv-50f4daf53d60cfb90107fd4989dd1869bc1f3e35.tar.gz mv-50f4daf53d60cfb90107fd4989dd1869bc1f3e35.tar.bz2 mv-50f4daf53d60cfb90107fd4989dd1869bc1f3e35.tar.xz mv-50f4daf53d60cfb90107fd4989dd1869bc1f3e35.zip |
Add support for removing item from mail.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 24 |
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; } |