~ubuntu-branches/ubuntu/vivid/manaplus/vivid

« back to all changes in this revision

Viewing changes to src/gui/windows/tradewindow.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2015-02-05 10:52:57 UTC
  • mfrom: (1.1.43)
  • Revision ID: package-import@ubuntu.com-20150205105257-q53e3m1s2wwawu8a
Tags: 1.5.1.31-1
* New upstream release.
* Fix some wildcard-matches-nothing-in-dep5-copyright warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
 
55
55
#include "net/tradehandler.h"
56
56
 
 
57
#include "utils/delete2.h"
57
58
#include "utils/gettext.h"
58
59
 
59
60
#include "debug.h"
74
75
    Window(_("Trade: You"), false, nullptr, "trade.xml"),
75
76
    ActionListener(),
76
77
    SelectionListener(),
77
 
    mMyInventory(new Inventory(Inventory::TRADE)),
78
 
    mPartnerInventory(new Inventory(Inventory::TRADE)),
79
 
    mMyItemContainer(new ItemContainer(this, mMyInventory.get())),
80
 
    mPartnerItemContainer(new ItemContainer(this, mPartnerInventory.get())),
 
78
    mMyInventory(new Inventory(InventoryType::TRADE)),
 
79
    mPartnerInventory(new Inventory(InventoryType::TRADE)),
 
80
    mMyItemContainer(new ItemContainer(this, mMyInventory)),
 
81
    mPartnerItemContainer(new ItemContainer(this, mPartnerInventory)),
81
82
    // TRANSLATORS: trade window money label
82
83
    mMoneyLabel(new Label(this, strprintf(_("You get %s"), ""))),
83
84
    // TRANSLATORS: trade window button
158
159
 
159
160
TradeWindow::~TradeWindow()
160
161
{
 
162
    delete2(mMyInventory);
 
163
    delete2(mPartnerInventory);
161
164
}
162
165
 
163
166
void TradeWindow::setMoney(const int amount)
201
204
                          const bool damaged,
202
205
                          const bool favorite) const
203
206
{
204
 
    Inventory *inv = own ? mMyInventory.get() : mPartnerInventory.get();
 
207
    Inventory *inv = own ? mMyInventory : mPartnerInventory;
205
208
    inv->addItem(id, type, quantity, refine, color,
206
209
        identified, damaged, favorite, false, false);
207
210
}
219
222
                           const bool favorite,
220
223
                           const bool equipment) const
221
224
{
222
 
    Inventory *inv = own ? mMyInventory.get() : mPartnerInventory.get();
 
225
    Inventory *inv = own ? mMyInventory : mPartnerInventory;
223
226
    const int slot = inv->addItem(id, type, quantity, refine, color,
224
227
        identified, damaged, favorite, equipment, false);
225
228
    if (slot >= 0)
364
367
        if (mMyInventory->getFreeSlot() == -1)
365
368
            return;
366
369
 
367
 
 
368
370
        if (!checkItem(item))
369
371
            return;
370
372