diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-01-05 11:27:54 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-01-05 11:27:54 +0000 |
commit | 86728f2e24e83cb8f853e32b48e405632dcbf5b1 (patch) | |
tree | 41801e9bba3c2a873797403a30e76295e6b5a412 /src/net/inventoryhandler.cpp | |
parent | c887f550b55b6160f074cb3160a4442ca659fad9 (diff) | |
download | mana-86728f2e24e83cb8f853e32b48e405632dcbf5b1.tar.gz mana-86728f2e24e83cb8f853e32b48e405632dcbf5b1.tar.bz2 mana-86728f2e24e83cb8f853e32b48e405632dcbf5b1.tar.xz mana-86728f2e24e83cb8f853e32b48e405632dcbf5b1.zip |
Added support for full inventory update.
Diffstat (limited to 'src/net/inventoryhandler.cpp')
-rw-r--r-- | src/net/inventoryhandler.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp index c6cc4a55..40febee2 100644 --- a/src/net/inventoryhandler.cpp +++ b/src/net/inventoryhandler.cpp @@ -44,6 +44,7 @@ InventoryHandler::InventoryHandler() SMSG_PLAYER_INVENTORY_USE, SMSG_ITEM_USE_RESPONSE, */ + GPMSG_INVENTORY_FULL, GPMSG_INVENTORY, 0 }; @@ -54,15 +55,22 @@ void InventoryHandler::handleMessage(MessageIn &msg) { switch (msg.getId()) { + case GPMSG_INVENTORY_FULL: + player_node->clearInventory(); + // no break! + case GPMSG_INVENTORY: while (msg.getUnreadLength()) { int slot = msg.readByte(); int id = msg.readShort(); - int amount = slot >= 32 ? msg.readByte() : 1; - Item *it = player_node->getInvItem(slot - 32); - it->setId(id); - it->setQuantity(amount); + if (slot >= 32) + { + int amount = msg.readByte(); + Item *it = player_node->getInvItem(slot - 32); + it->setId(id); + it->setQuantity(amount); + } }; break; |