diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-24 18:36:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-24 18:36:28 +0300 |
commit | db37480e7d36bb58b10ee1a4671ec18880e2bda2 (patch) | |
tree | 29134525adb690dd1c9f5c15a404e00c2581da95 /src/net/eathena/inventoryhandler.cpp | |
parent | 244649455b09a0a0b6de63329197bc2387492bfe (diff) | |
download | mv-db37480e7d36bb58b10ee1a4671ec18880e2bda2.tar.gz mv-db37480e7d36bb58b10ee1a4671ec18880e2bda2.tar.bz2 mv-db37480e7d36bb58b10ee1a4671ec18880e2bda2.tar.xz mv-db37480e7d36bb58b10ee1a4671ec18880e2bda2.zip |
eathena: impliment packet SMSG_CART_INFO.
Diffstat (limited to 'src/net/eathena/inventoryhandler.cpp')
-rw-r--r-- | src/net/eathena/inventoryhandler.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index dc134e87f..f29638829 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -753,9 +753,33 @@ void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg) void InventoryHandler::processCartInfo(Net::MessageIn &msg) { msg.readInt16("cart items used"); - msg.readInt16("max cart items"); + const int size = msg.readInt16("max cart items"); msg.readInt32("cart weight"); msg.readInt32("max cart weight"); + if (mCartItems.empty()) + return; + + Inventory *const inv = PlayerInfo::getCartInventory(); + if (!inv) + return; + + inv->resize(size); + + FOR_EACH (Ea::InventoryItems::const_iterator, it, mCartItems) + { + inv->setItem((*it).slot, + (*it).id, + (*it).type, + (*it).quantity, + (*it).refine, + (*it).color, + (*it).identified, + (*it).damaged, + (*it).favorite, + (*it).equip, + false); + } + mCartItems.clear(); } void InventoryHandler::processCartRemove(Net::MessageIn &msg A_UNUSED) |