diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-20 16:14:12 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-20 16:14:12 +0000 |
commit | 2fe42d32c6d368a66586c605cc1b38ee8d85ed1d (patch) | |
tree | 705a76dffde116ddbffb5cba9aa45e4b0700f280 /src/net/inventoryhandler.cpp | |
parent | 292f3e50a59b06bf129893b352466d7d54fa3d71 (diff) | |
download | mana-2fe42d32c6d368a66586c605cc1b38ee8d85ed1d.tar.gz mana-2fe42d32c6d368a66586c605cc1b38ee8d85ed1d.tar.bz2 mana-2fe42d32c6d368a66586c605cc1b38ee8d85ed1d.tar.xz mana-2fe42d32c6d368a66586c605cc1b38ee8d85ed1d.zip |
Changed MessageHandler::handleMessage to take a reference instead of a pointer.
Removed unused Packet class. Added stub for handling GPMSG_BEING_ENTER.
Diffstat (limited to 'src/net/inventoryhandler.cpp')
-rw-r--r-- | src/net/inventoryhandler.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp index 51c71f8d..cb1883b0 100644 --- a/src/net/inventoryhandler.cpp +++ b/src/net/inventoryhandler.cpp @@ -46,27 +46,27 @@ InventoryHandler::InventoryHandler() handledMessages = _messages; } -void InventoryHandler::handleMessage(MessageIn *msg) +void InventoryHandler::handleMessage(MessageIn &msg) { Sint32 number; Sint16 index, amount, itemId, equipType; - switch (msg->getId()) + switch (msg.getId()) { case SMSG_PLAYER_INVENTORY: // Only called on map load / warp. First reset all items // to not load them twice on map change. player_node->clearInventory(); - msg->readShort(); // length - number = (msg->getLength() - 4) / 18; + msg.readShort(); // length + number = (msg.getLength() - 4) / 18; for (int loop = 0; loop < number; loop++) { - index = msg->readShort(); - itemId = msg->readShort(); - msg->readByte(); // type - msg->readByte(); // identify flag - amount = msg->readShort(); + index = msg.readShort(); + itemId = msg.readShort(); + msg.readByte(); // type + msg.readByte(); // identify flag + amount = msg.readShort(); player_node->addInvItem(index, itemId, amount, false); @@ -79,16 +79,16 @@ void InventoryHandler::handleMessage(MessageIn *msg) break; case SMSG_PLAYER_INVENTORY_ADD: - index = msg->readShort(); - amount = msg->readShort(); - itemId = msg->readShort(); - msg->readByte(); // identify flag - msg->readByte(); // attribute - msg->readByte(); // refine - equipType = msg->readShort(); - msg->readByte(); // type - - if (msg->readByte()> 0) { + index = msg.readShort(); + amount = msg.readShort(); + itemId = msg.readShort(); + msg.readByte(); // identify flag + msg.readByte(); // attribute + msg.readByte(); // refine + equipType = msg.readShort(); + msg.readByte(); // type + + if (msg.readByte()> 0) { chatWindow->chatLog("Unable to pick up item", BY_SERVER); } else { player_node->addInvItem(index, itemId, amount, equipType != 0); @@ -96,26 +96,26 @@ void InventoryHandler::handleMessage(MessageIn *msg) break; case SMSG_PLAYER_INVENTORY_REMOVE: - index = msg->readShort(); - amount = msg->readShort(); + index = msg.readShort(); + amount = msg.readShort(); player_node->getInvItem(index)->increaseQuantity(-amount); break; case SMSG_PLAYER_INVENTORY_USE: - index = msg->readShort(); - msg->readShort(); // item id - msg->readLong(); // id - amount = msg->readShort(); - msg->readByte(); // type + index = msg.readShort(); + msg.readShort(); // item id + msg.readLong(); // id + amount = msg.readShort(); + msg.readByte(); // type player_node->getInvItem(index)->setQuantity(amount); break; case SMSG_ITEM_USE_RESPONSE: - index = msg->readShort(); - amount = msg->readShort(); + index = msg.readShort(); + amount = msg.readShort(); - if (msg->readByte() == 0) { + if (msg.readByte() == 0) { chatWindow->chatLog("Failed to use item", BY_SERVER); } else { player_node->getInvItem(index)->setQuantity(amount); |