diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-12-08 00:43:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-12-08 00:43:21 +0300 |
commit | c075c0daa245819d0a07fea6695f233fd329e397 (patch) | |
tree | 051f09fc1a5cf2ca256c50c9b77f246bb56b7b43 /src/actorspritemanager.cpp | |
parent | 1ba2a5d3f3687976cefd8b12cd3d001f754b55e3 (diff) | |
download | manaverse-c075c0daa245819d0a07fea6695f233fd329e397.tar.gz manaverse-c075c0daa245819d0a07fea6695f233fd329e397.tar.bz2 manaverse-c075c0daa245819d0a07fea6695f233fd329e397.tar.xz manaverse-c075c0daa245819d0a07fea6695f233fd329e397.zip |
Add to combined menu also floor items.
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r-- | src/actorspritemanager.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
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<Being*> &beings, +void ActorSpriteManager::findBeingsByPixel(std::vector<ActorSprite*> &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<Being*> &beings, if (!*it) continue; - if ((*it)->getType() == ActorSprite::FLOOR_ITEM - || (*it)->getType() == ActorSprite::PORTAL) - { + if ((*it)->getType() == ActorSprite::PORTAL) continue; - } - Being *being = static_cast<Being*>(*it); + Being *being = dynamic_cast<Being*>(*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); } } } |