diff options
Diffstat (limited to 'src/gui/trade.cpp')
-rw-r--r-- | src/gui/trade.cpp | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 8aa3c3ea..e6df9ad8 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -24,7 +24,7 @@ #include <guichan/font.hpp> #include "button.h" -#include "chat.h" +#include "widgets/chattab.h" #include "inventorywindow.h" #include "item_amount.h" #include "itemcontainer.h" @@ -51,20 +51,12 @@ #include "../utils/stringutils.h" #include "../utils/strprintf.h" -#ifdef TMWSERV_SUPPORT TradeWindow::TradeWindow(): -#else -TradeWindow::TradeWindow(Network *network): -#endif Window(_("Trade: You")), -#ifdef EATHENA_SUPPORT - mNetwork(network), - 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"); @@ -252,9 +244,8 @@ void TradeWindow::tradeItem(Item *item, int quantity) // function. Detect the actual server version, and re-enable this // for that version only. //addItem(item->getId(), true, quantity, item->isEquipment()); - MessageOut outMsg(mNetwork); - outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST); - outMsg.writeInt16(item->getInvIndex()); + MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST); + outMsg.writeInt16(item->getInvIndex() + INVENTORY_OFFSET); outMsg.writeInt32(quantity); #endif } @@ -329,8 +320,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) #ifdef TMWSERV_SUPPORT Net::GameServer::Player::acceptTrade(false); #else - MessageOut outMsg(mNetwork); - outMsg.writeInt16(CMSG_TRADE_CANCEL_REQUEST); + MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST); #endif } #ifdef EATHENA_SUPPORT @@ -342,8 +332,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) { mMoneyField->setText(toString(tempInt)); - MessageOut outMsg(mNetwork); - outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST); + MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST); outMsg.writeInt16(0); outMsg.writeInt32(tempInt); } @@ -352,8 +341,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) mMoneyField->setText(""); } mMoneyField->setEnabled(false); - MessageOut outMsg(mNetwork); - outMsg.writeInt16(CMSG_TRADE_ADD_COMPLETE); + MessageOut outMsg(CMSG_TRADE_ADD_COMPLETE); } #endif else if (event.getId() == "trade") @@ -362,8 +350,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) Net::GameServer::Player::acceptTrade(true); setStatus(PROPOSING); #else - MessageOut outMsg(mNetwork); - outMsg.writeInt16(CMSG_TRADE_OK); + MessageOut outMsg(CMSG_TRADE_OK); #endif } #ifdef TMWSERV_SUPPORT @@ -382,7 +369,6 @@ void TradeWindow::close() #ifdef TMWSERV_SUPPORT Net::GameServer::Player::acceptTrade(false); #else - MessageOut outMsg(mNetwork); - outMsg.writeInt16(CMSG_TRADE_CANCEL_REQUEST); + MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST); #endif } |