summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 8d05c81b..ea587afb 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -159,18 +159,26 @@ void Being::setDestination(int dstX, int dstY)
setDestination(mPos.x, mPos.y, dstX, dstY);
}
+Path Being::findPath()
+{
+ Path path;
+
+ if (mMap)
+ {
+ path = mMap->findPath(mPos.x / 32, mPos.y / 32,
+ mDest.x / 32, mDest.y / 32, getWalkMask());
+ }
+
+ return path;
+}
+
void Being::setDestination(int srcX, int srcY, int dstX, int dstY)
{
mDest.x = dstX;
mDest.y = dstY;
- Path thisPath;
+ Path thisPath = findPath();
- if (mMap)
- {
- thisPath = mMap->findPath((int) srcX / 32, (int) srcY / 32,
- dstX / 32, dstY / 32, getWalkMask());
- }
if (thisPath.empty())
{
setPath(Path());