From 1c6df6149ff8e68df97fe50b121ffac5b454abbe Mon Sep 17 00:00:00 2001 From: Claudio Hoffmann <hoffmanncl72341@th-nuernberg.de> Date: Sat, 16 Jan 2021 15:04:44 +0100 Subject: [PATCH] Entity: Don't takeDamage on 0 hit points --- Entity.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Entity.cpp b/Entity.cpp index 82ad6c3..707a854 100644 --- a/Entity.cpp +++ b/Entity.cpp @@ -62,7 +62,10 @@ bool Entity::step(Position const &PlayerPos, FloatSeconds const & Frametime, Lev int Entity::takeDamage(Color color) { - hitpoints = std::max((hitpoints - 1), 0); + if(hitpoints == 0) { + return hitpoints; + } + hitpoints--; hittime = HIT_TIME; hitcolor = color; return hitpoints; -- GitLab