summaryrefslogtreecommitdiff
path: root/src/game-server/being.cpp
diff options
context:
space:
mode:
authorRoderic Morris <roderic@ccs.neu.edu>2009-07-01 20:28:34 -0400
committerRoderic Morris <roderic@ccs.neu.edu>2009-07-01 20:41:47 -0400
commit2ea700fc0388d843795b71a9d259876ce975926f (patch)
treea64bdc3163f0ffb1663e34c3dae8de0c34953220 /src/game-server/being.cpp
parent6b794e76f8f046dca632299e443129c4f5ca3382 (diff)
downloadmanaserv-2ea700fc0388d843795b71a9d259876ce975926f.tar.gz
manaserv-2ea700fc0388d843795b71a9d259876ce975926f.tar.bz2
manaserv-2ea700fc0388d843795b71a9d259876ce975926f.tar.xz
manaserv-2ea700fc0388d843795b71a9d259876ce975926f.zip
Remove complex path finding for players. Add a simple path finding algorithm to map.
Diffstat (limited to 'src/game-server/being.cpp')
-rw-r--r--src/game-server/being.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp
index 069da14b..79b2e2fd 100644
--- a/src/game-server/being.cpp
+++ b/src/game-server/being.cpp
@@ -125,6 +125,15 @@ void Being::setDestination(const Point &dst)
mPath.clear();
}
+std::list<PATH_NODE> Being::findPath()
+{
+ mOld = getPosition();
+ int startX = mOld.x / 32, startY = mOld.y / 32;
+ int destX = mDst.x / 32, destY = mDst.y / 32;
+ Map *map = getMap()->getMap();
+ return map->findPath(startX, startY, destX, destY, getWalkMask());
+}
+
void Being::move()
{
mOld = getPosition();
@@ -169,7 +178,7 @@ void Being::move()
{
// No path exists: the walkability of cached path has changed, the
// destination has changed, or a path was never set.
- mPath = map->findPath(tileSX, tileSY, tileDX, tileDY, getWalkMask());
+ mPath = findPath();
}
if (mPath.empty())