From fc9391444b92f8334cbf9918e97cc3563dc52997 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Dec 2014 19:42:43 +0300 Subject: Move processPlayerStorageRemove from ea namespace into eathena and tmwa. --- src/net/ea/inventoryhandler.cpp | 18 ------------------ src/net/ea/inventoryhandler.h | 2 -- src/net/eathena/inventoryhandler.cpp | 18 ++++++++++++++++++ src/net/eathena/inventoryhandler.h | 2 ++ src/net/tmwa/inventoryhandler.cpp | 18 ++++++++++++++++++ src/net/tmwa/inventoryhandler.h | 2 ++ 6 files changed, 40 insertions(+), 20 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index c3ddc6c0c..dffcd18bc 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -270,24 +270,6 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg) BLOCK_END("InventoryHandler::processPlayerStorageStatus") } -void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg) -{ - BLOCK_START("InventoryHandler::processPlayerStorageRemove") - // Move an item out of storage - const int index = msg.readInt16("index") - STORAGE_OFFSET; - const int amount = msg.readInt16("amount"); - if (mStorage) - { - if (Item *const item = mStorage->getItem(index)) - { - item->increaseQuantity(-amount); - if (item->getQuantity() == 0) - mStorage->removeItemAt(index); - } - } - BLOCK_END("InventoryHandler::processPlayerStorageRemove") -} - void InventoryHandler::processPlayerStorageClose(Net::MessageIn &msg A_UNUSED) { BLOCK_START("InventoryHandler::processPlayerStorageClose") diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 3e393a98c..7458d0c6e 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -86,8 +86,6 @@ class InventoryHandler notfinal : public Net::InventoryHandler static void processPlayerStorageStatus(Net::MessageIn &msg); - static void processPlayerStorageRemove(Net::MessageIn &msg); - static void processPlayerStorageClose(Net::MessageIn &msg); static void processPlayerAttackRange(Net::MessageIn &msg); diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index ec2ba5b3c..cb4c6051c 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -706,4 +706,22 @@ int InventoryHandler::convertFromServerSlot(const int serverSlot) const return static_cast(EQUIP_CONVERT[serverSlot]); } +void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg) +{ + BLOCK_START("InventoryHandler::processPlayerStorageRemove") + // Move an item out of storage + const int index = msg.readInt16("index") - STORAGE_OFFSET; + const int amount = msg.readInt16("amount"); + if (mStorage) + { + if (Item *const item = mStorage->getItem(index)) + { + item->increaseQuantity(-amount); + if (item->getQuantity() == 0) + mStorage->removeItemAt(index); + } + } + BLOCK_END("InventoryHandler::processPlayerStorageRemove") +} + } // namespace EAthena diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index 794f9ca7a..7ab8bb42e 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -100,6 +100,8 @@ class InventoryHandler final : public MessageHandler, static void processPlayerItemRentalTime(Net::MessageIn &msg); static void processPlayerItemRentalExpired(Net::MessageIn &msg); + + static void processPlayerStorageRemove(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 5f89e3ebc..545c00b71 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -637,4 +637,22 @@ int InventoryHandler::convertFromServerSlot(const int serverSlot) const return static_cast(EQUIP_CONVERT[serverSlot]); } +void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg) +{ + BLOCK_START("InventoryHandler::processPlayerStorageRemove") + // Move an item out of storage + const int index = msg.readInt16("index") - STORAGE_OFFSET; + const int amount = msg.readInt16("amount"); + if (mStorage) + { + if (Item *const item = mStorage->getItem(index)) + { + item->increaseQuantity(-amount); + if (item->getQuantity() == 0) + mStorage->removeItemAt(index); + } + } + BLOCK_END("InventoryHandler::processPlayerStorageRemove") +} + } // namespace TmwAthena diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index d8caf7a84..5b3a48172 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -90,6 +90,8 @@ class InventoryHandler final : public MessageHandler, static void processPlayerStorageEquip(Net::MessageIn &msg); static void processPlayerStorageAdd(Net::MessageIn &msg); + + static void processPlayerStorageRemove(Net::MessageIn &msg); }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2