summaryrefslogtreecommitdiff
path: root/src/beingmanager.cpp
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2008-04-11 14:12:30 +0000
committerDavid Athay <ko2fan@gmail.com>2008-04-11 14:12:30 +0000
commitb50649ee5e28511df72cc3a08023747727c5b6f0 (patch)
tree1f1408b4550e70388ed1103747f973dbe77670f5 /src/beingmanager.cpp
parent760967f3c0dae0c352568a2865c57679559806fa (diff)
downloadmana-client-b50649ee5e28511df72cc3a08023747727c5b6f0.tar.gz
mana-client-b50649ee5e28511df72cc3a08023747727c5b6f0.tar.bz2
mana-client-b50649ee5e28511df72cc3a08023747727c5b6f0.tar.xz
mana-client-b50649ee5e28511df72cc3a08023747727c5b6f0.zip
Players now need to
click on the monster sprites rather than the tile. Players will now move to the target before attacking it.
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;