diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-03 23:13:07 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-03 23:13:07 +0200 |
commit | 9437d4943a8b299b057020ee114b230399965abd (patch) | |
tree | 54e8d1bca3c2f5457db8402fcdfe1b9e04df54f7 /src/gui/widgets/shopitems.cpp | |
parent | bb73cadd0afdc9fa55ea66ecedd8be53a6f3198e (diff) | |
download | plus-9437d4943a8b299b057020ee114b230399965abd.tar.gz plus-9437d4943a8b299b057020ee114b230399965abd.tar.bz2 plus-9437d4943a8b299b057020ee114b230399965abd.tar.xz plus-9437d4943a8b299b057020ee114b230399965abd.zip |
Add colors to buy/sell dialogs.
Diffstat (limited to 'src/gui/widgets/shopitems.cpp')
-rw-r--r-- | src/gui/widgets/shopitems.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp index 3e46f51a4..c0b93508e 100644 --- a/src/gui/widgets/shopitems.cpp +++ b/src/gui/widgets/shopitems.cpp @@ -49,23 +49,24 @@ std::string ShopItems::getElementAt(int i) return mShopItems.at(i)->getDisplayName(); } -void ShopItems::addItem(int id, int amount, int price) +void ShopItems::addItem(int id, unsigned char color, int amount, int price) { - mShopItems.push_back(new ShopItem(-1, id, amount, price)); + mShopItems.push_back(new ShopItem(-1, id, color, amount, price)); } -void ShopItems::addItemNoDup(int id, int amount, int price) +void ShopItems::addItemNoDup(int id, unsigned char color, int amount, int price) { - ShopItem *item = findItem(id); + ShopItem *item = findItem(id, color); if (!item) - mShopItems.push_back(new ShopItem(-1, id, amount, price)); + mShopItems.push_back(new ShopItem(-1, id, color, amount, price)); } -void ShopItems::addItem2(int inventoryIndex, int id, int quantity, int price) +void ShopItems::addItem2(int inventoryIndex, int id, unsigned char color, + int quantity, int price) { ShopItem *item = 0; if (mMergeDuplicates) - item = findItem(id); + item = findItem(id, color); if (item) { @@ -73,7 +74,7 @@ void ShopItems::addItem2(int inventoryIndex, int id, int quantity, int price) } else { - item = new ShopItem(inventoryIndex, id, quantity, price); + item = new ShopItem(inventoryIndex, id, color, quantity, price); mShopItems.push_back(item); } } @@ -100,7 +101,7 @@ void ShopItems::clear() mShopItems.clear(); } -ShopItem *ShopItems::findItem(int id) +ShopItem *ShopItems::findItem(int id, unsigned char color) { ShopItem *item; @@ -109,7 +110,7 @@ ShopItem *ShopItems::findItem(int id) while (it != e) { item = *(it); - if (item->getId() == id) + if (item->getId() == id && item->getColor() == color) return item; ++it; |