diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-09 17:40:06 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-09 17:40:06 +0300 |
commit | 8d519af0d6a5a7c3477e684269172b8163495a85 (patch) | |
tree | 027e57ee17fc5a663467358d0408b30c662c416e /src | |
parent | 1da80a3312ae865ed5d84271fc0cf53b82d87f15 (diff) | |
download | manaplus-8d519af0d6a5a7c3477e684269172b8163495a85.tar.gz manaplus-8d519af0d6a5a7c3477e684269172b8163495a85.tar.bz2 manaplus-8d519af0d6a5a7c3477e684269172b8163495a85.tar.xz manaplus-8d519af0d6a5a7c3477e684269172b8163495a85.zip |
Move processPlayerInventoryRemove from ea namespace into eathena and tmwa.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/ea/inventoryrecv.cpp | 21 | ||||
-rw-r--r-- | src/net/ea/inventoryrecv.h | 1 | ||||
-rw-r--r-- | src/net/eathena/inventoryrecv.cpp | 21 | ||||
-rw-r--r-- | src/net/eathena/inventoryrecv.h | 1 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 2 | ||||
-rw-r--r-- | src/net/tmwa/inventoryrecv.cpp | 21 | ||||
-rw-r--r-- | src/net/tmwa/inventoryrecv.h | 1 | ||||
-rw-r--r-- | src/net/tmwa/packetsin.inc | 2 |
8 files changed, 46 insertions, 24 deletions
diff --git a/src/net/ea/inventoryrecv.cpp b/src/net/ea/inventoryrecv.cpp index e7c1afb62..7a96e86cd 100644 --- a/src/net/ea/inventoryrecv.cpp +++ b/src/net/ea/inventoryrecv.cpp @@ -82,27 +82,6 @@ namespace InventoryRecv bool mDebugInventory = true; } // namespace InventoryRecv -void InventoryRecv::processPlayerInventoryRemove(Net::MessageIn &msg) -{ - BLOCK_START("InventoryRecv::processPlayerInventoryRemove") - Inventory *const inventory = localPlayer - ? PlayerInfo::getInventory() : nullptr; - - const int index = msg.readInt16("index") - INVENTORY_OFFSET; - const int amount = msg.readInt16("amount"); - if (inventory) - { - if (Item *const item = inventory->getItem(index)) - { - item->increaseQuantity(-amount); - if (item->getQuantity() == 0) - inventory->removeItemAt(index); - ArrowsListener::distributeEvent(); - } - } - BLOCK_END("InventoryRecv::processPlayerInventoryRemove") -} - void InventoryRecv::processPlayerInventoryUse(Net::MessageIn &msg) { BLOCK_START("InventoryRecv::processPlayerInventoryUse") diff --git a/src/net/ea/inventoryrecv.h b/src/net/ea/inventoryrecv.h index b6d6dbdce..52f442911 100644 --- a/src/net/ea/inventoryrecv.h +++ b/src/net/ea/inventoryrecv.h @@ -52,7 +52,6 @@ namespace Ea extern PickupQueue mSentPickups; extern bool mDebugInventory; - void processPlayerInventoryRemove(Net::MessageIn &msg); void processPlayerInventoryUse(Net::MessageIn &msg); void processItemUseResponse(Net::MessageIn &msg); void processPlayerStorageStatus(Net::MessageIn &msg); diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index 6d44f3847..d3496a149 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -979,4 +979,25 @@ void InventoryRecv::processBindItem(Net::MessageIn &msg) } } +void InventoryRecv::processPlayerInventoryRemove(Net::MessageIn &msg) +{ + BLOCK_START("InventoryRecv::processPlayerInventoryRemove") + Inventory *const inventory = localPlayer + ? PlayerInfo::getInventory() : nullptr; + + const int index = msg.readInt16("index") - INVENTORY_OFFSET; + const int amount = msg.readInt16("amount"); + if (inventory) + { + if (Item *const item = inventory->getItem(index)) + { + item->increaseQuantity(-amount); + if (item->getQuantity() == 0) + inventory->removeItemAt(index); + ArrowsListener::distributeEvent(); + } + } + BLOCK_END("InventoryRecv::processPlayerInventoryRemove") +} + } // namespace EAthena diff --git a/src/net/eathena/inventoryrecv.h b/src/net/eathena/inventoryrecv.h index b9dff5359..bb3dc3deb 100644 --- a/src/net/eathena/inventoryrecv.h +++ b/src/net/eathena/inventoryrecv.h @@ -69,6 +69,7 @@ namespace EAthena void processFavoriteItem(Net::MessageIn &msg); void processCartAddError(Net::MessageIn &msg); void processBindItem(Net::MessageIn &msg); + void processPlayerInventoryRemove(Net::MessageIn &msg); } // namespace InventoryRecv } // namespace EAthena diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index eeb955fef..7d463d043 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -310,7 +310,7 @@ packet(SMSG_PLAYER_IDENTIFY_LIST, 0x0177, -1, &InventoryRecv::processP packet(SMSG_PLAYER_INSERT_CARD, 0x017d, 7, &InventoryRecv::processPlayerInsertCard); packet(SMSG_PLAYER_INVENTORY, 0x0991, -1, &InventoryRecv::processPlayerInventory); packet(SMSG_PLAYER_INVENTORY_ADD, 0x0990, 31, &InventoryRecv::processPlayerInventoryAdd); -packet(SMSG_PLAYER_INVENTORY_REMOVE, 0x00af, 6, &Ea::InventoryRecv::processPlayerInventoryRemove); +packet(SMSG_PLAYER_INVENTORY_REMOVE, 0x00af, 6, &InventoryRecv::processPlayerInventoryRemove); packet(SMSG_PLAYER_INVENTORY_REMOVE2, 0x07fa, 8, &InventoryRecv::processPlayerInventoryRemove2); packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &Ea::InventoryRecv::processPlayerInventoryUse); packet(SMSG_PLAYER_ITEM_RENTAL_EXPIRED, 0x0299, 6, &InventoryRecv::processPlayerItemRentalExpired); diff --git a/src/net/tmwa/inventoryrecv.cpp b/src/net/tmwa/inventoryrecv.cpp index 02dd36978..815e4333c 100644 --- a/src/net/tmwa/inventoryrecv.cpp +++ b/src/net/tmwa/inventoryrecv.cpp @@ -458,4 +458,25 @@ void InventoryRecv::processPlayerStorageRemove(Net::MessageIn &msg) BLOCK_END("InventoryRecv::processPlayerStorageRemove") } +void InventoryRecv::processPlayerInventoryRemove(Net::MessageIn &msg) +{ + BLOCK_START("InventoryRecv::processPlayerInventoryRemove") + Inventory *const inventory = localPlayer + ? PlayerInfo::getInventory() : nullptr; + + const int index = msg.readInt16("index") - INVENTORY_OFFSET; + const int amount = msg.readInt16("amount"); + if (inventory) + { + if (Item *const item = inventory->getItem(index)) + { + item->increaseQuantity(-amount); + if (item->getQuantity() == 0) + inventory->removeItemAt(index); + ArrowsListener::distributeEvent(); + } + } + BLOCK_END("InventoryRecv::processPlayerInventoryRemove") +} + } // namespace TmwAthena diff --git a/src/net/tmwa/inventoryrecv.h b/src/net/tmwa/inventoryrecv.h index 091d18ab5..1bbf4db38 100644 --- a/src/net/tmwa/inventoryrecv.h +++ b/src/net/tmwa/inventoryrecv.h @@ -41,6 +41,7 @@ namespace TmwAthena void processPlayerStorageEquip(Net::MessageIn &msg); void processPlayerStorageAdd(Net::MessageIn &msg); void processPlayerStorageRemove(Net::MessageIn &msg); + void processPlayerInventoryRemove(Net::MessageIn &msg); } // namespace InventoryRecv } // namespace TmwAthena diff --git a/src/net/tmwa/packetsin.inc b/src/net/tmwa/packetsin.inc index afbf4550a..d82c65f8e 100644 --- a/src/net/tmwa/packetsin.inc +++ b/src/net/tmwa/packetsin.inc @@ -119,7 +119,7 @@ packet(SMSG_PLAYER_EQUIPMENT, 0x00a4, -1, &InventoryRecv::processP packet(SMSG_PLAYER_GUILD_PARTY_INFO, 0x0195, 102, &BeingRecv::processPlayerGuilPartyInfo); packet(SMSG_PLAYER_INVENTORY, 0x01ee, -1, &InventoryRecv::processPlayerInventory); packet(SMSG_PLAYER_INVENTORY_ADD, 0x00a0, 23, &InventoryRecv::processPlayerInventoryAdd); -packet(SMSG_PLAYER_INVENTORY_REMOVE, 0x00af, 6, &Ea::InventoryRecv::processPlayerInventoryRemove); +packet(SMSG_PLAYER_INVENTORY_REMOVE, 0x00af, 6, &InventoryRecv::processPlayerInventoryRemove); packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &Ea::InventoryRecv::processPlayerInventoryUse); packet(SMSG_PLAYER_MOVE, 0x01da, 60, &BeingRecv::processPlayerMove); packet(SMSG_PLAYER_MOVE_TO_ATTACK, 0x0139, 16, &Ea::BeingRecv::processPlayerMoveToAttack); |