From 8745368108563d7c32820b989c3ea794ccb834f9 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Thu, 25 Mar 2010 16:03:13 -0600 Subject: Remove the type boolean from InventoryWindow This moves inventory/storage type into the Inventory class, having size default to a call to the netcode to get the sive for the given type. Reviewed-by: Chuck Miller --- src/net/ea/inventoryhandler.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/net/ea/inventoryhandler.cpp') diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 1b191354..36d024f6 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -296,7 +296,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) int size = msg.readInt16(); // Max size if (!mStorage) - mStorage = new Inventory(size); + mStorage = new Inventory(Inventory::STORAGE, size); InventoryItems::iterator it = mInventoryItems.begin(); InventoryItems::iterator it_end = mInventoryItems.end(); @@ -472,26 +472,26 @@ void InventoryHandler::moveItem(int oldIndex, int newIndex) // Not implemented for eAthena (possible?) } -void InventoryHandler::openStorage(StorageType type) +void InventoryHandler::openStorage(int type) { // Doesn't apply to eAthena, since opening happens through NPCs? } -void InventoryHandler::closeStorage(StorageType type) +void InventoryHandler::closeStorage(int type) { MessageOut outMsg(CMSG_CLOSE_STORAGE); } -void InventoryHandler::moveItem(StorageType source, int slot, int amount, - StorageType destination) +void InventoryHandler::moveItem(int source, int slot, int amount, + int destination) { - if (source == INVENTORY && destination == STORAGE) + if (source == Inventory::INVENTORY && destination == Inventory::STORAGE) { MessageOut outMsg(CMSG_MOVE_TO_STORAGE); outMsg.writeInt16(slot + INVENTORY_OFFSET); outMsg.writeInt32(amount); } - else if (source == STORAGE && destination == INVENTORY) + else if (source == Inventory::STORAGE && destination == Inventory::INVENTORY) { MessageOut outMsg(CSMG_MOVE_FROM_STORAGE); outMsg.writeInt16(slot + STORAGE_OFFSET); @@ -499,16 +499,18 @@ void InventoryHandler::moveItem(StorageType source, int slot, int amount, } } -size_t InventoryHandler::getSize(StorageType type) const +size_t InventoryHandler::getSize(int type) const { switch (type) { - case INVENTORY: + case Inventory::INVENTORY: return 100; - case STORAGE: - return 0; + case Inventory::STORAGE: + return 0; // Comes from server after items + case Inventory::TRADE: + return 12; case GUILD_STORAGE: - return 0; + return 0; // Comes from server after items default: return 0; } -- cgit v1.2.3-70-g09d2