From 4f02ad59df9ee3314fb0d429a031ecbfa3206e3a Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Fri, 27 Mar 2009 23:25:43 +0100 Subject: Moved the inventory and storage offset handling into netcode No need to complicate the item containers and inventory classes with a silly offset used by the eAthena server. Also fixed the logToStandardOut option by reading it from the config after the configuration has been initialized. --- src/gui/storagewindow.cpp | 8 ++++---- src/gui/trade.cpp | 11 ++++------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'src/gui') diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp index 690758ed..8c25401d 100644 --- a/src/gui/storagewindow.cpp +++ b/src/gui/storagewindow.cpp @@ -187,17 +187,17 @@ Item* StorageWindow::getSelectedItem() const return mItems->getSelectedItem(); } -void StorageWindow::addStore(Item* item, int ammount) +void StorageWindow::addStore(Item *item, int ammount) { MessageOut outMsg(CMSG_MOVE_TO_STORAGE); - outMsg.writeInt16(item->getInvIndex()); + outMsg.writeInt16(item->getInvIndex() + INVENTORY_OFFSET); outMsg.writeInt32(ammount); } -void StorageWindow::removeStore(Item* item, int ammount) +void StorageWindow::removeStore(Item *item, int ammount) { MessageOut outMsg(CSMG_MOVE_FROM_STORAGE); - outMsg.writeInt16(item->getInvIndex()); + outMsg.writeInt16(item->getInvIndex() + STORAGE_OFFSET); outMsg.writeInt32(ammount); } diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 6926eb82..e6df9ad8 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -53,13 +53,10 @@ TradeWindow::TradeWindow(): Window(_("Trade: You")), -#ifdef EATHENA_SUPPORT - mMyInventory(new Inventory(INVENTORY_SIZE, 2)), - mPartnerInventory(new Inventory(INVENTORY_SIZE, 2)) -#else mMyInventory(new Inventory(INVENTORY_SIZE)), - mPartnerInventory(new Inventory(INVENTORY_SIZE)), - mStatus(PREPARING) + mPartnerInventory(new Inventory(INVENTORY_SIZE)) +#ifdef TMWSERV_SUPPORT + , mStatus(PREPARING) #endif { setWindowName("Trade"); @@ -248,7 +245,7 @@ void TradeWindow::tradeItem(Item *item, int quantity) // for that version only. //addItem(item->getId(), true, quantity, item->isEquipment()); MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST); - outMsg.writeInt16(item->getInvIndex()); + outMsg.writeInt16(item->getInvIndex() + INVENTORY_OFFSET); outMsg.writeInt32(quantity); #endif } -- cgit v1.2.3-70-g09d2