summaryrefslogtreecommitdiff
path: root/src/actorspritemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-12-08 00:43:21 +0300
committerAndrei Karas <akaras@inbox.ru>2011-12-08 00:43:21 +0300
commitc075c0daa245819d0a07fea6695f233fd329e397 (patch)
tree051f09fc1a5cf2ca256c50c9b77f246bb56b7b43 /src/actorspritemanager.cpp
parent1ba2a5d3f3687976cefd8b12cd3d001f754b55e3 (diff)
downloadplus-c075c0daa245819d0a07fea6695f233fd329e397.tar.gz
plus-c075c0daa245819d0a07fea6695f233fd329e397.tar.bz2
plus-c075c0daa245819d0a07fea6695f233fd329e397.tar.xz
plus-c075c0daa245819d0a07fea6695f233fd329e397.zip
Add to combined menu also floor items.
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r--src/actorspritemanager.cpp26
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);
}
}
}