summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-12-23 02:16:53 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-12-23 02:16:53 +0000
commitd83e795dc3c8a07238939ee0b581cbfd1807cf1b (patch)
tree5ce6c06c867c61fffe934a67b2636c6c7a9e8b79 /src/player.cpp
parent8d3e43a7510dd7367c3bb62aae6841836f727493 (diff)
downloadmana-client-d83e795dc3c8a07238939ee0b581cbfd1807cf1b.tar.gz
mana-client-d83e795dc3c8a07238939ee0b581cbfd1807cf1b.tar.bz2
mana-client-d83e795dc3c8a07238939ee0b581cbfd1807cf1b.tar.xz
mana-client-d83e795dc3c8a07238939ee0b581cbfd1807cf1b.zip
Particle images are now reference-counted properly. Avoided attempts to load "data/graphics/" when a monster or equipment piece has no sprite. Error placeholder is now used when attempting to load a sprite definition file that doesn't exist.
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/player.cpp b/src/player.cpp
index a1a86587..3d8a8b6e 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -153,8 +153,15 @@ void Player::setSprite(int slot, int id, std::string color)
}
else
{
- AnimatedSprite *equipmentSprite = AnimatedSprite::load(
- "graphics/sprites/" + ItemDB::get(id).getSprite(mGender) + "|" + color);
+ std::string filename = ItemDB::get(id).getSprite(mGender);
+ AnimatedSprite *equipmentSprite = NULL;
+
+ if (filename != "")
+ {
+ if (color!="") filename += "|" + color;
+ equipmentSprite = AnimatedSprite::load(
+ "graphics/sprites/" + filename);
+ }
if (equipmentSprite)
equipmentSprite->setDirection(getSpriteDirection());