~ubuntu-branches/ubuntu/saucy/manaplus/saucy-proposed

« back to all changes in this revision

Viewing changes to src/gui/tradewindow.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi, Andrei Karas, Patrick Matthäi
  • Date: 2013-06-10 10:53:26 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130610105326-c3xqk5ebcgy3jxmb
Tags: 1.3.6.9-1
[ Andrei Karas ]
* Add new files to copyright file.

[ Patrick Matthäi ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
    mOkOther(false),
90
90
    mOkMe(false)
91
91
{
92
 
    logger->log1("TradeWindow::TradeWindow nick");
93
 
 
94
92
    setWindowName("Trade");
95
93
    setResizable(true);
96
94
    setCloseButton(true);
182
180
    mGotMoney = amount;
183
181
    // TRANSLATORS: trade window money label
184
182
    mMoneyLabel->setCaption(strprintf(_("You get %s"),
185
 
                            Units::formatCurrency(amount).c_str()));
 
183
        Units::formatCurrency(amount).c_str()));
186
184
    mMoneyLabel->adjustSize();
187
185
}
188
186
 
208
206
void TradeWindow::changeQuantity(const int index, const bool own,
209
207
                                 const int quantity) const
210
208
{
 
209
    Item *item;
211
210
    if (own)
212
 
    {
213
 
        if (mMyInventory->getItem(index))
214
 
            mMyInventory->getItem(index)->setQuantity(quantity);
215
 
    }
 
211
        item = mMyInventory->getItem(index);
216
212
    else
217
 
    {
218
 
        if (mPartnerInventory->getItem(index))
219
 
            mPartnerInventory->getItem(index)->setQuantity(quantity);
220
 
    }
 
213
        item = mPartnerInventory->getItem(index);
 
214
    if (item)
 
215
        item->setQuantity(quantity);
221
216
}
222
217
 
223
218
void TradeWindow::increaseQuantity(const int index, const bool own,
224
219
                                   const int quantity) const
225
220
{
 
221
    Item *item;
226
222
    if (own)
227
 
    {
228
 
        if (mMyInventory->getItem(index))
229
 
            mMyInventory->getItem(index)->increaseQuantity(quantity);
230
 
    }
 
223
        item = mMyInventory->getItem(index);
231
224
    else
232
 
    {
233
 
        if (mPartnerInventory->getItem(index))
234
 
            mPartnerInventory->getItem(index)->increaseQuantity(quantity);
235
 
    }
 
225
        item = mPartnerInventory->getItem(index);
 
226
    if (item)
 
227
        item->increaseQuantity(quantity);
236
228
}
237
229
 
238
230
void TradeWindow::reset()
363
355
        setVisible(false);
364
356
        reset();
365
357
        PlayerInfo::setTrading(false);
366
 
 
367
358
        Net::getTradeHandler()->cancel();
368
359
    }
369
360
    else if (eventId == "ok")
436
427
    mAutoMoney = money;
437
428
}
438
429
 
439
 
void TradeWindow::initTrade(std::string nick)
 
430
void TradeWindow::initTrade(const std::string &nick)
440
431
{
441
432
    if (!player_node)
442
433
        return;