summaryrefslogtreecommitdiff
path: root/src/actorspritemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-05 20:44:43 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-05 20:44:43 +0300
commit93e87e3d637b1a98a5f0cfee945e8ceb7799fcad (patch)
tree4db9a5b6068b92e0d5a7c0115c5164cf6fadc6de /src/actorspritemanager.cpp
parent4a73dd1338353a5d23c7de970c47995ee32ff500 (diff)
downloadplus-93e87e3d637b1a98a5f0cfee945e8ceb7799fcad.tar.gz
plus-93e87e3d637b1a98a5f0cfee945e8ceb7799fcad.tar.bz2
plus-93e87e3d637b1a98a5f0cfee945e8ceb7799fcad.tar.xz
plus-93e87e3d637b1a98a5f0cfee945e8ceb7799fcad.zip
Increase mouse selection radius if only one object near mouse.
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r--src/actorspritemanager.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index e8244bc30..5f28f237c 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -301,8 +301,8 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
return NULL;
bool targetDead = mTargetDeadPlayers;
- const int xtol = 16;
- const int uptol = 32;
+ Being *tempBeing = 0;
+ bool noBeing(false);
for_actors
{
@@ -319,17 +319,29 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
&& (allPlayers || being != player_node))
{
- if ((being->getPixelX() - xtol <= x) &&
- (being->getPixelX() + xtol > x) &&
- (being->getPixelY() - uptol <= y) &&
+ if ((being->getPixelX() - 16 <= x) &&
+ (being->getPixelX() + 16 > x) &&
+ (being->getPixelY() - 32 <= y) &&
(being->getPixelY() > y))
{
return being;
}
+ else if (!noBeing && (being->getPixelX() - 32 <= x) &&
+ (being->getPixelX() + 32 > x) &&
+ (being->getPixelY() - 64 <= y) &&
+ (being->getPixelY() + 16 > y))
+ {
+ if (tempBeing)
+ noBeing = true;
+ else
+ tempBeing = being;
+ }
}
}
- return NULL;
+ if (noBeing)
+ return 0;
+ return tempBeing;
}
void ActorSpriteManager::findBeingsByPixel(std::vector<Being*> &beings,