summaryrefslogtreecommitdiff
path: root/src/actormanager.cpp
diff options
context:
space:
mode:
authorJoseph Botosh <rumly111@gmail.com>2015-07-24 15:55:30 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-25 21:39:05 +0300
commit60906e87e854f6420804839db7b2afadb69662bb (patch)
treefee04d39cef15dc48ba6e55dcdeac74d4ee8fe59 /src/actormanager.cpp
parentf5d2e707df5171146af3fe1366ecb8fa17b56eea (diff)
downloadmanaverse-60906e87e854f6420804839db7b2afadb69662bb.tar.gz
manaverse-60906e87e854f6420804839db7b2afadb69662bb.tar.bz2
manaverse-60906e87e854f6420804839db7b2afadb69662bb.tar.xz
manaverse-60906e87e854f6420804839db7b2afadb69662bb.zip
healmd checks healing radius
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r--src/actormanager.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index fe4892f4a..8bd4ed638 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -40,6 +40,7 @@
#include "input/inputmanager.h"
#include "utils/checkutils.h"
+#include "utils/mathutils.h"
#include "utils/gettext.h"
#include "net/beinghandler.h"
@@ -1288,7 +1289,7 @@ void ActorManager::heal(const Being *const target) const
}
}
-Being* ActorManager::findMostDamagedPlayer() const
+Being* ActorManager::findMostDamagedPlayer(const int maxTileDist) const
{
if (!localPlayer)
return nullptr;
@@ -1311,6 +1312,12 @@ Being* ActorManager::findMostDamagedPlayer() const
continue;
}
+ const int dx = being->getTileX() - localPlayer->getTileX();
+ const int dy = being->getTileY() - localPlayer->getTileY();
+ const int distance = fastSqrtInt(dx * dx + dy * dy);
+
+ if (distance > maxTileDist)
+ continue;
if (being->getDamageTaken() > maxDamageTaken)
{