diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-05-14 03:23:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-05-14 03:23:49 +0300 |
commit | eedeca17b9867762093e330d68bf21aea9e75fba (patch) | |
tree | e1acce6753ffedeff5ea4c80dc3399f6dd0260c9 /src/being.cpp | |
parent | 1a04f34a62dc82833dbe994a9f11d543b6a78928 (diff) | |
download | mv-eedeca17b9867762093e330d68bf21aea9e75fba.tar.gz mv-eedeca17b9867762093e330d68bf21aea9e75fba.tar.bz2 mv-eedeca17b9867762093e330d68bf21aea9e75fba.tar.xz mv-eedeca17b9867762093e330d68bf21aea9e75fba.zip |
Add missing checks.
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/being.cpp b/src/being.cpp index 383d392f8..688e838ee 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -522,7 +522,6 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type) } else if (!amount) { - if (attacker == player_node) { // This is intended to be the wrong direction to visually @@ -581,8 +580,7 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type) { // Show damage number particleEngine->addTextSplashEffect(damage, - getPixelX(), getPixelY() - 16, - color, font, true); + getPixelX(), getPixelY() - 16, color, font, true); } attacker->updateHit(amount); @@ -595,15 +593,9 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type) mDamageTaken += amount; if (mInfo) { - if (attacker) - { - sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT), - attacker->getTileX(), attacker->getTileY()); - } - else - { - sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT)); - } + sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT), + attacker->getTileX(), attacker->getTileY()); + if (!mInfo->isStaticMaxHP()) { if (!mHP && mInfo->getMaxHP() < mDamageTaken) |