From 3f5c128b889b4cb41f9782fe1531c55e7d07432f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Jan 2015 15:31:06 +0300 Subject: Move inventory type into separate file. --- src/net/ea/inventoryhandler.cpp | 10 +++++----- src/net/ea/inventoryhandler.h | 6 ------ src/net/eathena/inventoryhandler.cpp | 18 +++++++++--------- src/net/tmwa/inventoryhandler.cpp | 6 +++--- 4 files changed, 17 insertions(+), 23 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 1be2e5be2..e81b0a490 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -130,14 +130,14 @@ size_t InventoryHandler::getSize(const int type) const { switch (type) { - case Inventory::INVENTORY: + case InventoryType::INVENTORY: return 100; - case Inventory::STORAGE: + case InventoryType::STORAGE: return 0; // Comes from server after items - case Inventory::TRADE: + case InventoryType::TRADE: return 12; // GUILD_STORAGE - case Inventory::TYPE_END: + case InventoryType::TYPE_END: return 0; // Comes from server after items default: return 0; @@ -248,7 +248,7 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg) const int size = msg.readInt16("max size"); if (!mStorage) - mStorage = new Inventory(Inventory::STORAGE, size); + mStorage = new Inventory(InventoryType::STORAGE, size); FOR_EACH (Ea::InventoryItems::const_iterator, it, mInventoryItems) { diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 0b9c208cc..be9fb0e52 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -48,12 +48,6 @@ typedef std::queue PickupQueue; class InventoryHandler notfinal : public Net::InventoryHandler { public: - enum - { - GUILD_STORAGE = Inventory::TYPE_END, - CART - }; - A_DELETE_COPY(InventoryHandler) virtual ~InventoryHandler(); diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index da8091f98..d8001b74f 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -264,26 +264,26 @@ void InventoryHandler::moveItem2(const int source, { int packet = 0; int offset = INVENTORY_OFFSET; - if (source == Inventory::INVENTORY) + if (source == InventoryType::INVENTORY) { - if (destination == Inventory::STORAGE) + if (destination == InventoryType::STORAGE) packet = CMSG_MOVE_TO_STORAGE; - else if (destination == Inventory::CART) + else if (destination == InventoryType::CART) packet = CMSG_MOVE_TO_CART; } - else if (source == Inventory::STORAGE) + else if (source == InventoryType::STORAGE) { offset = STORAGE_OFFSET; - if (destination == Inventory::INVENTORY) + if (destination == InventoryType::INVENTORY) packet = CSMG_MOVE_FROM_STORAGE; - else if (destination == Inventory::CART) + else if (destination == InventoryType::CART) packet = CMSG_MOVE_FROM_STORAGE_TO_CART; } - else if (source == Inventory::CART) + else if (source == InventoryType::CART) { - if (destination == Inventory::INVENTORY) + if (destination == InventoryType::INVENTORY) packet = CMSG_MOVE_FROM_CART; - else if (destination == Inventory::STORAGE) + else if (destination == InventoryType::STORAGE) packet = CMSG_MOVE_FROM_CART_TO_STORAGE; } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 8fa8a497e..7821d9aca 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -223,15 +223,15 @@ void InventoryHandler::closeStorage(const int type A_UNUSED) const void InventoryHandler::moveItem2(const int source, const int slot, const int amount, const int destination) const { - if (source == Inventory::INVENTORY && destination == Inventory::STORAGE) + if (source == InventoryType::INVENTORY && destination == InventoryType::STORAGE) { createOutPacket(CMSG_MOVE_TO_STORAGE); outMsg.writeInt16(static_cast(slot + INVENTORY_OFFSET), "index"); outMsg.writeInt32(amount, "amount"); } - else if (source == Inventory::STORAGE - && destination == Inventory::INVENTORY) + else if (source == InventoryType::STORAGE + && destination == InventoryType::INVENTORY) { createOutPacket(CSMG_MOVE_FROM_STORAGE); outMsg.writeInt16(static_cast(slot + STORAGE_OFFSET), -- cgit v1.2.3-70-g09d2