diff options
author | Roderic Morris <roderic@ccs.neu.edu> | 2009-07-01 20:28:34 -0400 |
---|---|---|
committer | Roderic Morris <roderic@ccs.neu.edu> | 2009-07-01 20:41:47 -0400 |
commit | 2ea700fc0388d843795b71a9d259876ce975926f (patch) | |
tree | a64bdc3163f0ffb1663e34c3dae8de0c34953220 /src/game-server/character.cpp | |
parent | 6b794e76f8f046dca632299e443129c4f5ca3382 (diff) | |
download | manaserv-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/character.cpp')
-rw-r--r-- | src/game-server/character.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index f2b746e3..0488e4ec 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -114,6 +114,15 @@ void Character::update() Being::update(); } +std::list<PATH_NODE> Character::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->findSimplePath(startX, startY, destX, destY, getWalkMask()); +} + void Character::perform() { if (mAction != ATTACK || mTarget == NULL) return; |