summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/inventoryhandler.cpp16
-rw-r--r--src/net/protocol.h1
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