summaryrefslogtreecommitdiff
path: root/src/shopitem.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-08 22:19:17 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-08 22:19:17 +0200
commit6ac9a6b3e3e5fe8958646a18c6e81a25aa5bb326 (patch)
treee2f2e375e53f0324925f1ae0b4da07ec44e65769 /src/shopitem.cpp
parent07c9e6360ac16c96b8624a4b0bf4557ae295699d (diff)
downloadplus-6ac9a6b3e3e5fe8958646a18c6e81a25aa5bb326.tar.gz
plus-6ac9a6b3e3e5fe8958646a18c6e81a25aa5bb326.tar.bz2
plus-6ac9a6b3e3e5fe8958646a18c6e81a25aa5bb326.tar.xz
plus-6ac9a6b3e3e5fe8958646a18c6e81a25aa5bb326.zip
Show item colors in buy dialog.
Diffstat (limited to 'src/shopitem.cpp')
-rw-r--r--src/shopitem.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index 861d03bdc..a87c1f3f9 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -22,6 +22,7 @@
#include "shopitem.h"
+#include "client.h"
#include "units.h"
#include "utils/stringutils.h"
@@ -34,8 +35,16 @@ ShopItem::ShopItem(int inventoryIndex, int id, unsigned char color,
mPrice(price),
mShowQuantity(true)
{
- mDisplayName = getInfo().getName() + " ("
- + Units::formatCurrency(mPrice).c_str() + ") ";
+ if (serverVersion > 0)
+ {
+ mDisplayName = getInfo().getName(color) + " ("
+ + Units::formatCurrency(mPrice).c_str() + ") ";
+ }
+ else
+ {
+ mDisplayName = getInfo().getName() + " ("
+ + Units::formatCurrency(mPrice).c_str() + ") ";
+ }
if (quantity > 0)
mDisplayName += "[" + toString(quantity) + "]";
@@ -48,8 +57,16 @@ ShopItem::ShopItem (int id, unsigned char color, int price) :
mPrice(price),
mShowQuantity(false)
{
- mDisplayName = getInfo().getName() +
- " (" + Units::formatCurrency(mPrice).c_str() + ")";
+ if (serverVersion > 0)
+ {
+ mDisplayName = getInfo().getName(color) +
+ " (" + Units::formatCurrency(mPrice).c_str() + ")";
+ }
+ else
+ {
+ mDisplayName = getInfo().getName() +
+ " (" + Units::formatCurrency(mPrice).c_str() + ")";
+ }
setInvIndex(-1);
addDuplicate(-1, 0);
}
@@ -68,8 +85,16 @@ void ShopItem::update()
{
if (mShowQuantity)
{
- mDisplayName = getInfo().getName() + " ("
- + Units::formatCurrency(mPrice).c_str() + ") ";
+ if (serverVersion > 0)
+ {
+ mDisplayName = getInfo().getName(mColor) + " ("
+ + Units::formatCurrency(mPrice).c_str() + ") ";
+ }
+ else
+ {
+ mDisplayName = getInfo().getName() + " ("
+ + Units::formatCurrency(mPrice).c_str() + ") ";
+ }
if (mQuantity > 0)
mDisplayName += "[" + toString(mQuantity) + "]";
}