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 | |
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')
-rw-r--r-- | src/net/inventoryhandler.cpp | 16 | ||||
-rw-r--r-- | src/net/protocol.h | 1 |
2 files changed, 13 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; diff --git a/src/net/protocol.h b/src/net/protocol.h index 2fbd59e4..096ba29c 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -151,6 +151,7 @@ enum { PGMSG_DROP = 0x0111, // B slot, B amount PGMSG_EQUIP = 0x0112, // B slot GPMSG_INVENTORY = 0x0120, // { B slot, W item id [, B amount] }* + GPMSG_INVENTORY_FULL = 0x0121, // { B slot, W item id [, B amount] }* GPMSG_BEING_ENTER = 0x0200, // B type, W being id // player: S name, B hair style, B hair color, B gender // monster: W type id |