From c075c0daa245819d0a07fea6695f233fd329e397 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Dec 2011 00:43:21 +0300 Subject: Add to combined menu also floor items. --- src/actorspritemanager.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/actorspritemanager.cpp') diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 4403738f9..e0a59b349 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -406,13 +406,12 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y, } } -void ActorSpriteManager::findBeingsByPixel(std::vector &beings, +void ActorSpriteManager::findBeingsByPixel(std::vector &beings, int x, int y, bool allPlayers) const { if (!mMap) return; - bool targetDead = mTargetDeadPlayers; const int xtol = 16; const int uptol = 32; @@ -421,25 +420,24 @@ void ActorSpriteManager::findBeingsByPixel(std::vector &beings, if (!*it) continue; - if ((*it)->getType() == ActorSprite::FLOOR_ITEM - || (*it)->getType() == ActorSprite::PORTAL) - { + if ((*it)->getType() == ActorSprite::PORTAL) continue; - } - Being *being = static_cast(*it); + Being *being = dynamic_cast(*it); + ActorSprite *actor = *it; - if ((being->isAlive() - || (targetDead && being->getType() == Being::PLAYER)) + if ((being && (being->isAlive() + || (mTargetDeadPlayers && being->getType() == Being::PLAYER)) && (allPlayers || being != player_node)) + || actor->getType() == ActorSprite::FLOOR_ITEM) { - if ((being->getPixelX() - xtol <= x) && - (being->getPixelX() + xtol > x) && - (being->getPixelY() - uptol <= y) && - (being->getPixelY() > y)) + if ((actor->getPixelX() - xtol <= x) && + (actor->getPixelX() + xtol > x) && + (actor->getPixelY() - uptol <= y) && + (actor->getPixelY() > y)) { - beings.push_back(being); + beings.push_back(actor); } } } -- cgit v1.2.3-70-g09d2