summaryrefslogtreecommitdiff
path: root/src/being.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/being.cpp
parent41e84157e0eca3a494cd6d44eec96dfbde0f5626 (diff)
downloadmv-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.gz
mv-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.bz2
mv-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.xz
mv-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.zip
First part of implimintation item colors.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 7265aa337..2f2e69d16 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -1483,8 +1483,8 @@ void Being::updateColors()
}
}
-void Being::setSprite(unsigned int slot, int id, const std::string &color,
- bool isWeapon, bool isTempSprite)
+void Being::setSprite(unsigned int slot, int id, std::string color,
+ unsigned char colorId, bool isWeapon, bool isTempSprite)
{
if (slot >= Net::getCharHandler()->maxSprite())
return;
@@ -1508,13 +1508,15 @@ void Being::setSprite(unsigned int slot, int id, const std::string &color,
}
else
{
- std::string filename = ItemDB::get(id).getSprite(mGender);
+ ItemInfo info = ItemDB::get(id);
+ std::string filename = info.getSprite(mGender);
AnimatedSprite *equipmentSprite = NULL;
if (!filename.empty())
{
- if (!color.empty())
- filename += "|" + color;
+ if (color.empty())
+ color = info.getDyeColorsString(colorId);
+ filename = combineDye(filename, color);
equipmentSprite = AnimatedSprite::load(
paths.getStringValue("sprites") + filename);
@@ -1931,7 +1933,7 @@ void Being::recalcSpritesOrder()
if (repIt->second != 1)
{
setSprite(removeSprite, repIt->second,
- mSpriteColors[removeSprite], false, true);
+ mSpriteColors[removeSprite], 1, false, true);
}
}
}
@@ -2066,7 +2068,7 @@ void Being::recalcSpritesOrder()
if (!id)
continue;
- setSprite(slot, id, mSpriteColors[slot], false, true);
+ setSprite(slot, id, mSpriteColors[slot], 1, false, true);
}
// logger->log("slot %d = %d", slot, mSpriteRemap[slot]);
}