summaryrefslogtreecommitdiff
path: root/src/beingmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/beingmanager.cpp')
-rw-r--r--src/beingmanager.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index daceca5e..4e3ab0fa 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -124,6 +124,27 @@ Being* BeingManager::findBeing(Uint16 x, Uint16 y, Being::Type type)
return (i == mBeings.end()) ? NULL : *i;
}
+Being* BeingManager::findBeingByPixel(Uint16 x, Uint16 y)
+{
+ BeingIterator itr = mBeings.begin();
+ BeingIterator itr_end = mBeings.end();
+
+ for (; itr != itr_end; ++itr)
+ {
+ Being *being = (*itr);
+ if ((being->mAction != Being::DEAD) &&
+ (being->getPixelX() <= x) &&
+ (being->getPixelX() + being->getWidth() >= x) &&
+ (being->getPixelY() <= y) &&
+ (being->getPixelY() + being->getHeight() >= y))
+ {
+ return being;
+ }
+ }
+
+ return NULL;
+}
+
Beings& BeingManager::getAll()
{
return mBeings;