summaryrefslogtreecommitdiff
path: root/src/item.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-28 21:37:19 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-28 21:37:19 +0300
commit03bfe2db420e0b219451590e14bb34c03c71f03c (patch)
treec3cb081449261b51f1ffefa2da4ba39fa5645888 /src/item.cpp
parentc47ef8b3f2ec6ea0e26748af17cb12b7f9cd20c9 (diff)
downloadmv-03bfe2db420e0b219451590e14bb34c03c71f03c.tar.gz
mv-03bfe2db420e0b219451590e14bb34c03c71f03c.tar.bz2
mv-03bfe2db420e0b219451590e14bb34c03c71f03c.tar.xz
mv-03bfe2db420e0b219451590e14bb34c03c71f03c.zip
improve some other files.
Diffstat (limited to 'src/item.cpp')
-rw-r--r--src/item.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/item.cpp b/src/item.cpp
index 261279002..aa58b4167 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -70,7 +70,6 @@ void Item::setId(const int id, const unsigned char color)
// Types 0 and 1 are not equippable items.
mEquipment = id && getInfo().getType() >= 2;
- // Load the associated image
if (mImage)
mImage->decRef();
@@ -81,10 +80,9 @@ void Item::setId(const int id, const unsigned char color)
const ItemInfo &info = getInfo();
mTags = info.getTags();
- SpriteDisplay display = info.getDisplay();
- std::string imagePath = paths.getStringValue(
- "itemIcons").append(display.image);
- std::string dye = combineDye2(imagePath, info.getDyeColorsString(color));
+ const std::string dye = combineDye2(paths.getStringValue(
+ "itemIcons").append(info.getDisplay().image),
+ info.getDyeColorsString(color));
mImage = resman->getImage(dye);
mDrawImage = resman->getImage(dye);
@@ -112,10 +110,8 @@ Image *Item::getImage(const int id, const unsigned char color)
{
ResourceManager *const resman = ResourceManager::getInstance();
const ItemInfo &info = ItemDB::get(id);
- SpriteDisplay display = info.getDisplay();
- std::string imagePath = paths.getStringValue(
- "itemIcons").append(display.image);
- Image *image = resman->getImage(combineDye2(imagePath,
+ Image *image = resman->getImage(combineDye2(paths.getStringValue(
+ "itemIcons").append(info.getDisplay().image),
info.getDyeColorsString(color)));
if (!image)