summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being.cpp4
-rw-r--r--src/being.h4
-rw-r--r--src/beingmanager.cpp19
3 files changed, 16 insertions, 11 deletions
diff --git a/src/being.cpp b/src/being.cpp
index d32ffa59..442c08ef 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -603,7 +603,7 @@ int Being::getWidth() const
return mSprites[BASE_SPRITE]->getWidth();
}
else {
- return 0;
+ return Being::DEFAULT_WIDTH;
}
}
@@ -614,7 +614,7 @@ int Being::getHeight() const
return mSprites[BASE_SPRITE]->getHeight();
}
else {
- return 0;
+ return Being::DEFAULT_HEIGHT;
}
}
diff --git a/src/being.h b/src/being.h
index aeb03564..0591777e 100644
--- a/src/being.h
+++ b/src/being.h
@@ -411,6 +411,10 @@ class Being : public Sprite
std::list<Particle *> mChildParticleEffects;
private:
+
+ static const int Being::DEFAULT_WIDTH = 32;
+ static const int Being::DEFAULT_HEIGHT = 32;
+
// Speech Bubble components
SpeechBubble *mSpeechBubble;
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index 6d9267d2..7f3d8845 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -123,12 +123,13 @@ Being* BeingManager::findBeingByPixel(Uint16 x, Uint16 y)
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))
+ int xtol = being->getWidth() / 2;
+ int uptol = being->getHeight();
+ if ((being != player_node) &&
+ (being->getPixelX() - xtol <= x) &&
+ (being->getPixelX() + xtol >= x) &&
+ (being->getPixelY() - uptol <= y) &&
+ (being->getPixelY() >= y))
{
return being;
}
@@ -190,7 +191,7 @@ Being* BeingManager::findNearestLivingBeing(Uint16 x, Uint16 y, int maxdist,
//in map coords, while down below its in pixels
//
//I believe there is a deeper problem under this, but
- //for a temp solution we'll convert to coords to pixels
+ //for a temp solution we'll convert to coords to pixels
x = x * 32;
y = y * 32;
maxdist = maxdist * 32;
@@ -210,8 +211,8 @@ Being* BeingManager::findNearestLivingBeing(Uint16 x, Uint16 y, int maxdist,
closestBeing = being;
}
}
-
- return (maxdist >= dist) ? closestBeing : NULL;
+
+ return (maxdist >= dist) ? closestBeing : NULL;
}
Being* BeingManager::findNearestLivingBeing(Being *aroundBeing, int maxdist,