diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-11-02 21:46:36 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-11-02 21:46:36 +0000 |
commit | 46308b7e9d65dd734664f903a09c3210f1684a6c (patch) | |
tree | 40624fd5d6d4c33fc078e64d00d16db56b485db4 /src/player.cpp | |
parent | 19e15c87a1fc74f71fd6f9a743201a24ac582997 (diff) | |
download | mana-46308b7e9d65dd734664f903a09c3210f1684a6c.tar.gz mana-46308b7e9d65dd734664f903a09c3210f1684a6c.tar.bz2 mana-46308b7e9d65dd734664f903a09c3210f1684a6c.tar.xz mana-46308b7e9d65dd734664f903a09c3210f1684a6c.zip |
Merged trunk changes from revision 2757 to 2800 into the 0.1.0 branch.
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/player.cpp b/src/player.cpp index f5f42e9f..12f5f3d5 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -93,12 +93,12 @@ Player::setHairColor(Uint16 color) { if (color != mHairColor) { - delete mSprites[HAIR_SPRITE]; AnimatedSprite *newHairSprite = new AnimatedSprite( "graphics/sprites/hairstyle" + toString(mHairStyle) + ".xml", color); newHairSprite->setDirection(getSpriteDirection()); + delete mSprites[HAIR_SPRITE]; mSprites[HAIR_SPRITE] = newHairSprite; resetAnimations(); @@ -113,12 +113,12 @@ Player::setHairStyle(Uint16 style) { if (style != mHairStyle) { - delete mSprites[HAIR_SPRITE]; AnimatedSprite *newHairSprite = new AnimatedSprite( "graphics/sprites/hairstyle" + toString(style) + ".xml", mHairColor); newHairSprite->setDirection(getSpriteDirection()); + delete mSprites[HAIR_SPRITE]; mSprites[HAIR_SPRITE] = newHairSprite; resetAnimations(); @@ -145,11 +145,14 @@ Player::setVisibleEquipment(Uint8 slot, Uint8 id) break; } - delete mSprites[position]; - mSprites[position] = NULL; - // id = 0 means unequip - if (id) { + if (id == 0) + { + delete mSprites[position]; + mSprites[position] = NULL; + } + else + { char stringId[4]; sprintf(stringId, "%03i", id); @@ -157,6 +160,7 @@ Player::setVisibleEquipment(Uint8 slot, Uint8 id) "graphics/sprites/item" + toString(stringId) + ".xml", 0); equipmentSprite->setDirection(getSpriteDirection()); + delete mSprites[position]; mSprites[position] = equipmentSprite; resetAnimations(); |