summaryrefslogtreecommitdiff
path: root/src/item.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-27 18:08:34 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-27 23:26:17 +0200
commitdf5c7ae83a80db63ab90142df9e3a93f5ee630d0 (patch)
tree465991eb7785c1d17e1b15f6798efa67951a0c83 /src/item.cpp
parent41e84157e0eca3a494cd6d44eec96dfbde0f5626 (diff)
downloadplus-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.gz
plus-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.bz2
plus-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.xz
plus-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.zip
First part of implimintation item colors.
Diffstat (limited to 'src/item.cpp')
-rw-r--r--src/item.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/item.cpp b/src/item.cpp
index c3c9b9c18..02f775834 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -75,8 +75,9 @@ void Item::setId(int id, unsigned char color)
SpriteDisplay display = info.getDisplay();
std::string imagePath = paths.getStringValue("itemIcons")
+ display.image;
- mImage = resman->getImage(imagePath);
- mDrawImage = resman->getImage(imagePath);
+ std::string dye = combineDye(imagePath, info.getDyeString(color));
+ mImage = resman->getImage(dye);
+ mDrawImage = resman->getImage(dye);
if (!mImage)
{
@@ -98,12 +99,14 @@ bool Item::isHaveTag(int tagId)
return mTags[tagId] > 0;
}
-Image *Item::getImage(int id)
+Image *Item::getImage(int id, unsigned char color)
{
ResourceManager *resman = ResourceManager::getInstance();
- SpriteDisplay display = ItemDB::get(id).getDisplay();
+ ItemInfo info = ItemDB::get(id);
+ SpriteDisplay display = info.getDisplay();
std::string imagePath = "graphics/items/" + display.image;
- Image *image = resman->getImage(imagePath);
+ Image *image;
+ image = resman->getImage(combineDye(imagePath, info.getDyeString(color)));
if (!image)
image = Theme::getImageFromTheme("unknown-item.png");