diff options
author | Fabian <fenstein12@googlemail.com> | 2017-11-22 14:47:52 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2017-11-22 14:47:52 +0100 |
commit | 0dd172b80ffc949cf87119ad2003589d7eb82c46 (patch) | |
tree | a7af747aa95241297f07104c138cfc66cf7f6c97 /src/Entities/Entity.cpp | |
parent | cBlockRail: Fix assertion failure (#4075) (diff) | |
download | cuberite-0dd172b80ffc949cf87119ad2003589d7eb82c46.tar cuberite-0dd172b80ffc949cf87119ad2003589d7eb82c46.tar.gz cuberite-0dd172b80ffc949cf87119ad2003589d7eb82c46.tar.bz2 cuberite-0dd172b80ffc949cf87119ad2003589d7eb82c46.tar.lz cuberite-0dd172b80ffc949cf87119ad2003589d7eb82c46.tar.xz cuberite-0dd172b80ffc949cf87119ad2003589d7eb82c46.tar.zst cuberite-0dd172b80ffc949cf87119ad2003589d7eb82c46.zip |
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r-- | src/Entities/Entity.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 90aefd082..11405d2fd 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -528,9 +528,9 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) Player->GetStatManager().AddValue(statDamageDealt, static_cast<StatValue>(floor(a_TDI.FinalDamage * 10 + 0.5))); } - m_Health -= static_cast<short>(a_TDI.FinalDamage); + m_Health -= static_cast<float>(a_TDI.FinalDamage); - m_Health = std::max(m_Health, 0); + m_Health = std::max(m_Health, 0.0f); // Add knockback: if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != nullptr)) @@ -810,9 +810,9 @@ void cEntity::Heal(int a_HitPoints) -void cEntity::SetHealth(int a_Health) +void cEntity::SetHealth(float a_Health) { - m_Health = Clamp(a_Health, 0, m_MaxHealth); + m_Health = Clamp(a_Health, 0.0f, m_MaxHealth); } @@ -1782,7 +1782,7 @@ void cEntity::OnFinishedBurning(void) -void cEntity::SetMaxHealth(int a_MaxHealth) +void cEntity::SetMaxHealth(float a_MaxHealth) { m_MaxHealth = a_MaxHealth; |