From a3c8b12ee99ec53fbbf3b36bd71a8f45cf274c1d Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 7 Jul 2013 15:09:05 +0000 Subject: Mobs are assigned MaxHealth from monsters.ini; reading monsters.ini doesn't need settings.ini values anymore. Fixes FS #409. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1662 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Entity.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/Entity.cpp') diff --git a/source/Entity.cpp b/source/Entity.cpp index d9855afb0..80fe0d266 100644 --- a/source/Entity.cpp +++ b/source/Entity.cpp @@ -431,6 +431,15 @@ void cEntity::Heal(int a_HitPoints) +void cEntity::SetHealth(int a_Health) +{ + m_Health = std::max(0, std::min(m_MaxHealth, a_Health)); +} + + + + + void cEntity::Tick(float a_Dt, cChunk & a_Chunk) { if (m_AttachedTo != NULL) -- cgit v1.2.3