summaryrefslogtreecommitdiff
path: root/src/actorspritemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-08 00:43:48 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-08 00:43:48 +0300
commitdbc3b324a0c5dcb1a0ee29b289e71423a06e85fd (patch)
treef7cda00f7415c35fb2a9e4466a751d18852070bf /src/actorspritemanager.cpp
parentcbb805a1922e3423fdaae88242835fb717a903bf (diff)
downloadplus-dbc3b324a0c5dcb1a0ee29b289e71423a06e85fd.tar.gz
plus-dbc3b324a0c5dcb1a0ee29b289e71423a06e85fd.tar.bz2
plus-dbc3b324a0c5dcb1a0ee29b289e71423a06e85fd.tar.xz
plus-dbc3b324a0c5dcb1a0ee29b289e71423a06e85fd.zip
Add to npc option targetSelection to allow/disallow npc selection.
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r--src/actorspritemanager.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index dbd9c6692..4d4511476 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -44,6 +44,8 @@
#include "net/net.h"
#include "net/playerhandler.h"
+#include "resources/beinginfo.h"
+
#include <algorithm>
#include <list>
@@ -348,6 +350,9 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
Being *being = static_cast<Being*>(*it);
+ if (being->getInfo() && !being->getInfo()->isTargetSelection())
+ continue;
+
if ((being->isAlive()
|| (targetDead && being->getType() == Being::PLAYER))
&& (allPlayers || being != player_node))
@@ -392,6 +397,9 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
Being *being = static_cast<Being*>(*it);
+ if (being->getInfo() && !being->getInfo()->isTargetSelection())
+ continue;
+
if ((being->getPixelX() - 16 <= x) &&
(being->getPixelX() + 16 > x) &&
(being->getPixelY() - 32 <= y) &&
@@ -422,6 +430,10 @@ void ActorSpriteManager::findBeingsByPixel(std::vector<ActorSprite*> &beings,
continue;
Being *being = dynamic_cast<Being*>(*it);
+
+ if (being->getInfo() && !being->getInfo()->isTargetSelection())
+ continue;
+
ActorSprite *actor = *it;
if ((being && (being->isAlive()
@@ -905,6 +917,10 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
continue;
}
}
+
+ if (being->getInfo() && !being->getInfo()->isTargetSelection())
+ continue;
+
if (validateBeing(aroundBeing, being, type, nullptr, maxDist))
{
if (being != excluded)
@@ -997,6 +1013,9 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
}
}
+ if (being->getInfo() && !being->getInfo()->isTargetSelection())
+ continue;
+
// Being *being = (*i);
bool valid = validateBeing(aroundBeing, being, type, excluded, 50);