diff options
Diffstat (limited to 'src/gui/trade.cpp')
-rw-r--r-- | src/gui/trade.cpp | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index dcb38e8e..37662bef 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -21,9 +21,11 @@ #include "gui/trade.h" +#include "event.h" #include "inventory.h" #include "item.h" #include "localplayer.h" +#include "playerinfo.h" #include "units.h" #include "gui/inventorywindow.h" @@ -31,7 +33,6 @@ #include "gui/setup.h" #include "gui/widgets/button.h" -#include "gui/widgets/chattab.h" #include "gui/widgets/itemcontainer.h" #include "gui/widgets/label.h" #include "gui/widgets/scrollarea.h" @@ -59,7 +60,7 @@ TradeWindow::TradeWindow(): mMyInventory(new Inventory(Inventory::TRADE)), mPartnerInventory(new Inventory(Inventory::TRADE)), mStatus(PROPOSING) -{ +{ setWindowName("Trade"); setResizable(true); setCloseButton(true); @@ -96,7 +97,7 @@ TradeWindow::TradeWindow(): mMoneyLabel = new Label(strprintf(_("You get %s"), "")); gcn::Label *mMoneyLabel2 = new Label(_("You give:")); - + mMoneyField = new TextField; mMoneyField->setWidth(40); mMoneyChangeButton = new Button(_("Change"), "money", this); @@ -140,18 +141,6 @@ void TradeWindow::addItem(int id, bool own, int quantity) (own ? mMyInventory : mPartnerInventory)->addItem(id, quantity); } -void TradeWindow::addItem(int id, bool own, int quantity, bool equipment) -{ - if (own) - { - mMyInventory->addItem(id, quantity, equipment); - } - else - { - mPartnerInventory->addItem(id, quantity, equipment); - } -} - void TradeWindow::changeQuantity(int index, bool own, int quantity) { if (own) @@ -270,9 +259,8 @@ void TradeWindow::action(const gcn::ActionEvent &event) if (mMyInventory->contains(item)) { - localChatTab->chatLog(_("Failed adding item. You can not " - "overlap one kind of item on the window."), - BY_SERVER); + SERVER_NOTICE(_("Failed adding item. You can not " + "overlap one kind of item on the window.")) return; } @@ -285,7 +273,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) { setVisible(false); reset(); - player_node->setTrading(false); + PlayerInfo::setTrading(false); Net::getTradeHandler()->cancel(); } @@ -310,11 +298,10 @@ void TradeWindow::action(const gcn::ActionEvent &event) return; int v = atoi(mMoneyField->getText().c_str()); - int curMoney = player_node->getMoney(); + int curMoney = PlayerInfo::getAttribute(MONEY); if (v > curMoney) { - localChatTab->chatLog(_("You don't have enough money."), - BY_SERVER); + SERVER_NOTICE(_("You don't have enough money.")) v = curMoney; } Net::getTradeHandler()->setMoney(v); |