summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-24 18:36:28 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-24 18:36:28 +0300
commitdb37480e7d36bb58b10ee1a4671ec18880e2bda2 (patch)
tree29134525adb690dd1c9f5c15a404e00c2581da95 /src
parent244649455b09a0a0b6de63329197bc2387492bfe (diff)
downloadmanaplus-db37480e7d36bb58b10ee1a4671ec18880e2bda2.tar.gz
manaplus-db37480e7d36bb58b10ee1a4671ec18880e2bda2.tar.bz2
manaplus-db37480e7d36bb58b10ee1a4671ec18880e2bda2.tar.xz
manaplus-db37480e7d36bb58b10ee1a4671ec18880e2bda2.zip
eathena: impliment packet SMSG_CART_INFO.
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/inventoryhandler.cpp26
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)