summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-21 17:43:19 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-21 17:43:19 +0300
commite3ad003fe09ff90524ffa5deae844e6721b903b2 (patch)
tree756f8cae3ee12060548384ece6750a25bee4ab45 /src/gui/windows
parent4ab7d38fe9033695e23042e97b55999b26f00fd7 (diff)
downloadplus-e3ad003fe09ff90524ffa5deae844e6721b903b2.tar.gz
plus-e3ad003fe09ff90524ffa5deae844e6721b903b2.tar.bz2
plus-e3ad003fe09ff90524ffa5deae844e6721b903b2.tar.xz
plus-e3ad003fe09ff90524ffa5deae844e6721b903b2.zip
Set cards from net code.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/tradewindow.cpp30
-rw-r--r--src/gui/windows/tradewindow.h2
2 files changed, 12 insertions, 20 deletions
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index 6bf091625..c7cd1712d 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -199,19 +199,14 @@ void TradeWindow::addItem(const int id,
const bool damaged,
const bool favorite) const
{
- if (own)
- {
- mMyInventory->addItem(id, quantity, refine, color,
- identified, damaged, favorite, false, false);
- }
- else
- {
- mPartnerInventory->addItem(id, quantity, refine, color,
- identified, damaged, favorite, false, false);
- }
+ Inventory *inv = own ? mMyInventory.get() : mPartnerInventory.get();
+ inv->addItem(id, quantity, refine, color,
+ identified, damaged, favorite, false, false);
}
void TradeWindow::addItem2(const int id,
+ const int *const cards,
+ const int sz,
const bool own,
const int quantity,
const uint8_t refine,
@@ -221,16 +216,11 @@ void TradeWindow::addItem2(const int id,
const bool favorite,
const bool equipment) const
{
- if (own)
- {
- mMyInventory->addItem(id, quantity, refine, color,
- identified, damaged, favorite, equipment, false);
- }
- else
- {
- mPartnerInventory->addItem(id, quantity, refine, color,
- identified, damaged, favorite, equipment, false);
- }
+ Inventory *inv = own ? mMyInventory.get() : mPartnerInventory.get();
+ const int slot = inv->addItem(id, quantity, refine, color,
+ identified, damaged, favorite, equipment, false);
+ if (slot >= 0)
+ inv->setCards(slot, cards, sz);
}
void TradeWindow::changeQuantity(const int index, const bool own,
diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h
index 8f8067902..5c782cf07 100644
--- a/src/gui/windows/tradewindow.h
+++ b/src/gui/windows/tradewindow.h
@@ -85,6 +85,8 @@ class TradeWindow final : public Window,
* Add an item to the trade window.
*/
void addItem2(const int id,
+ const int *const cards,
+ const int sz,
const bool own,
const int quantity,
const uint8_t refine,