summaryrefslogtreecommitdiff
path: root/src/actormanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-18 15:47:51 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-18 15:47:51 +0300
commita80f8f578a78752b5b43f3aeb8759b0db4c51714 (patch)
treef4edfcf9f994f1ac919d88de7ad8921eb8a475c9 /src/actormanager.cpp
parentb8fd168c06687338268226ac4e8292549c31bbfc (diff)
downloadmanaverse-a80f8f578a78752b5b43f3aeb8759b0db4c51714.tar.gz
manaverse-a80f8f578a78752b5b43f3aeb8759b0db4c51714.tar.bz2
manaverse-a80f8f578a78752b5b43f3aeb8759b0db4c51714.tar.xz
manaverse-a80f8f578a78752b5b43f3aeb8759b0db4c51714.zip
Improve a bit findBeingsByPixel.
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r--src/actormanager.cpp76
1 files changed, 51 insertions, 25 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index cf7884a9f..fe4e55687 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -542,36 +542,62 @@ void ActorManager::findBeingsByPixel(std::vector<ActorSprite*> &beings,
for_actors
{
- if (!*it)
- continue;
-
- if ((*it)->getType() == ActorType::Portal)
- continue;
-
- const Being *const being = dynamic_cast<const Being*>(*it);
+ ActorSprite *const actor = *it;
- if (being && being->getInfo()
- && !(being->getInfo()->isTargetSelection() || modActive))
- {
+ if (!actor)
continue;
- }
-
- ActorSprite *const actor = *it;
- if ((being &&
- (being->isAlive() ||
- (mTargetDeadPlayers &&
- being->getType() == ActorType::Player)) &&
- (allPlayers == AllPlayers_true ||
- being != localPlayer)) ||
- actor->getType() == ActorType::FloorItem)
+ const ActorTypeT actorType = actor->getType();
+ switch (actorType)
{
- if ((actor->getPixelX() - xtol <= x) &&
- (actor->getPixelX() + xtol > x) &&
- (actor->getPixelY() - uptol <= y) &&
- (actor->getPixelY() > y))
+ default:
+ case ActorType::Unknown:
+ case ActorType::Avatar:
+ case ActorType::Portal:
+ break;
+ case ActorType::FloorItem:
+ if ((actor->getPixelX() - xtol <= x) &&
+ (actor->getPixelX() + xtol > x) &&
+ (actor->getPixelY() - uptol <= y) &&
+ (actor->getPixelY() > y))
+ {
+ beings.push_back(actor);
+ }
+ break;
+ case ActorType::Player:
+ case ActorType::Npc:
+ case ActorType::Monster:
+ case ActorType::LocalPet:
+#ifdef EATHENA_SUPPORT
+ case ActorType::Pet:
+ case ActorType::Mercenary:
+ case ActorType::Homunculus:
+ case ActorType::SkillUnit:
+#endif
{
- beings.push_back(actor);
+ const Being *const being = static_cast<const Being*>(*it);
+ if (!being)
+ continue;
+ if (being->getInfo() &&
+ !(being->getInfo()->isTargetSelection() || modActive))
+ {
+ continue;
+ }
+ if ((being->isAlive() ||
+ (mTargetDeadPlayers &&
+ actorType == ActorType::Player)) &&
+ (allPlayers == AllPlayers_true ||
+ being != localPlayer))
+ {
+ if ((actor->getPixelX() - xtol <= x) &&
+ (actor->getPixelX() + xtol > x) &&
+ (actor->getPixelY() - uptol <= y) &&
+ (actor->getPixelY() > y))
+ {
+ beings.push_back(actor);
+ }
+ }
+ break;
}
}
}