summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-03 23:13:07 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-03 23:13:07 +0200
commit9437d4943a8b299b057020ee114b230399965abd (patch)
tree54e8d1bca3c2f5457db8402fcdfe1b9e04df54f7 /src/gui/widgets
parentbb73cadd0afdc9fa55ea66ecedd8be53a6f3198e (diff)
downloadManaVerse-9437d4943a8b299b057020ee114b230399965abd.tar.gz
ManaVerse-9437d4943a8b299b057020ee114b230399965abd.tar.bz2
ManaVerse-9437d4943a8b299b057020ee114b230399965abd.tar.xz
ManaVerse-9437d4943a8b299b057020ee114b230399965abd.zip
Add colors to buy/sell dialogs.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/shopitems.cpp21
-rw-r--r--src/gui/widgets/shopitems.h9
2 files changed, 16 insertions, 14 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;
diff --git a/src/gui/widgets/shopitems.h b/src/gui/widgets/shopitems.h
index 949dcfc78..2b2dcc5eb 100644
--- a/src/gui/widgets/shopitems.h
+++ b/src/gui/widgets/shopitems.h
@@ -55,7 +55,7 @@ class ShopItems : public gcn::ListModel
/**
* Adds an item to the list.
*/
- void addItem(int id, int amount, int price);
+ void addItem(int id, unsigned char color, int amount, int price);
/**
* Adds an item to the list (used by sell dialog). Looks for
@@ -66,9 +66,10 @@ class ShopItems : public gcn::ListModel
* @param quantity number of available copies of the item
* @param price price of the item
*/
- void addItem2(int inventoryIndex, int id, int amount, int price);
+ void addItem2(int inventoryIndex, int id, unsigned char color,
+ int amount, int price);
- void addItemNoDup(int id, int amount, int price);
+ void addItemNoDup(int id, unsigned char color, int amount, int price);
/**
* Returns the number of items in the shop.
@@ -109,7 +110,7 @@ class ShopItems : public gcn::ListModel
*
* @return the item found or 0
*/
- ShopItem *findItem(int id);
+ ShopItem *findItem(int id, unsigned char color);
/** The list of items in the shop. */
std::vector<ShopItem*> mShopItems;