summaryrefslogtreecommitdiff
path: root/src/beingmanager.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-10-31 23:01:23 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-10-31 23:01:23 +0000
commit052cdbd8fce689b64371da82409bfd4e0f189f45 (patch)
tree316c8a69defc2a9ca69d9e3a4840de44db8d2382 /src/beingmanager.cpp
parent6d928722369bc1db7f17d3fb0d0cb69ce304d39b (diff)
downloadmana-052cdbd8fce689b64371da82409bfd4e0f189f45.tar.gz
mana-052cdbd8fce689b64371da82409bfd4e0f189f45.tar.bz2
mana-052cdbd8fce689b64371da82409bfd4e0f189f45.tar.xz
mana-052cdbd8fce689b64371da82409bfd4e0f189f45.zip
Merged revisions 4071,4093,4100,4363 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/branches/0.0 ........ r4071 | the_enemy | 2008-04-11 16:12:30 +0200 (Fri, 11 Apr 2008) | 3 lines Players now need to click on the monster sprites rather than the tile. Players will now move to the target before attacking it. ........ r4093 | the_enemy | 2008-04-15 18:10:32 +0200 (Tue, 15 Apr 2008) | 1 line Fixed clicking near player. ........ r4100 | peaveydk | 2008-04-16 13:59:36 +0200 (Wed, 16 Apr 2008) | 1 line Cancel walking to a clicked monster if the target is lost while getting to it (killed or otherwise removed). ........ r4363 | crush_tmw | 2008-06-24 14:42:04 +0200 (Tue, 24 Jun 2008) | 1 line corrected date in changelog ........
Diffstat (limited to 'src/beingmanager.cpp')
-rw-r--r--src/beingmanager.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index 2ab29fd2..40f438df 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -117,6 +117,28 @@ 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 != player_node) &&
+ (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;