summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-05 01:03:01 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-05 01:03:01 +0300
commit9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24 (patch)
treeb4c985f231f965b2d6a024058c79202b8b7553d6 /src/net
parentc80c18c42249407a386fd6b484597e03acc32437 (diff)
downloadmv-9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24.tar.gz
mv-9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24.tar.bz2
mv-9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24.tar.xz
mv-9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24.zip
Fix adding stackable items to mail.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/mail2recv.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/net/eathena/mail2recv.cpp b/src/net/eathena/mail2recv.cpp
index d3537a48a..b2e435bee 100644
--- a/src/net/eathena/mail2recv.cpp
+++ b/src/net/eathena/mail2recv.cpp
@@ -145,24 +145,34 @@ void Mail2Recv::processAddItemResult(Net::MessageIn &msg)
delete options;
return;
}
- const int slot = inventory->addItem(itemId,
- itemType,
- amount,
- refine,
- ItemColorManager::getColorFromCards(&cards[0]),
- fromBool(identify, Identified),
- damaged,
- Favorite_false,
- Equipm_false,
- Equipped_false);
- if (slot == -1)
+
+ Item *const item = inventory->findItemByTag(index);
+ if (item == nullptr)
{
- delete options;
- return;
+ const int slot = inventory->addItem(itemId,
+ itemType,
+ amount,
+ refine,
+ ItemColorManager::getColorFromCards(&cards[0]),
+ fromBool(identify, Identified),
+ damaged,
+ Favorite_false,
+ Equipm_false,
+ Equipped_false);
+ if (slot == -1)
+ {
+ delete options;
+ return;
+ }
+ inventory->setCards(slot, cards, maxCards);
+ inventory->setOptions(slot, options);
+ inventory->setTag(slot, index);
}
- inventory->setCards(slot, cards, maxCards);
- inventory->setOptions(slot, options);
- inventory->setTag(slot, index);
+ else
+ {
+ item->increaseQuantity(amount);
+ }
+
mailEditWindow->updateItems();
delete options;
}