diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-21 01:41:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-21 01:41:13 +0300 |
commit | 1f846d2863d36543c854fe630519a4d1fd01f802 (patch) | |
tree | 68271299e6d33417d36690f1be6b4544d3aaa224 /src/actorspritemanager.cpp | |
parent | 8138d0e61f633546263df94473e91d500ada9c0e (diff) | |
download | mv-1f846d2863d36543c854fe630519a4d1fd01f802.tar.gz mv-1f846d2863d36543c854fe630519a4d1fd01f802.tar.bz2 mv-1f846d2863d36543c854fe630519a4d1fd01f802.tar.xz mv-1f846d2863d36543c854fe630519a4d1fd01f802.zip |
Improve mouse object selection if near mixed floor items and monsters.
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r-- | src/actorspritemanager.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 03418a857..52d807f64 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -308,9 +308,22 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y, if (!*it) continue; - if ((*it)->getType() == ActorSprite::FLOOR_ITEM - || (*it)->getType() == ActorSprite::PORTAL) + if ((*it)->getType() == ActorSprite::PORTAL) + continue; + + if ((*it)->getType() == ActorSprite::FLOOR_ITEM) { + if (!noBeing) + { + FloorItem *floor = static_cast<FloorItem*>(*it); + if (!noBeing && (floor->getPixelX() - 32 <= x) && + (floor->getPixelX() + 32 > x) && + (floor->getPixelY() - 64 <= y) && + (floor->getPixelY() + 16 > y)) + { + noBeing = true; + } + } continue; } |