summaryrefslogtreecommitdiff
path: root/src/game-server/monster.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-03-13 07:29:01 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-03-13 07:29:01 +0000
commitefe4ef65bedbaa66e35f3a4354f7422c313ce624 (patch)
treec1259e6a60e80ee5b8ba97c44f9223071aba4df7 /src/game-server/monster.cpp
parent344fe375ff6e7db425da6ca266e02ea93dd7cc4d (diff)
downloadmanaserv-efe4ef65bedbaa66e35f3a4354f7422c313ce624.tar.gz
manaserv-efe4ef65bedbaa66e35f3a4354f7422c313ce624.tar.bz2
manaserv-efe4ef65bedbaa66e35f3a4354f7422c313ce624.tar.xz
manaserv-efe4ef65bedbaa66e35f3a4354f7422c313ce624.zip
Implemented dynamic and selective pathblocking. Monsters are blocked by player characters and other monsters, player characters only by monsters.
Diffstat (limited to 'src/game-server/monster.cpp')
-rw-r--r--src/game-server/monster.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp
index 46225e9a..d782eae0 100644
--- a/src/game-server/monster.cpp
+++ b/src/game-server/monster.cpp
@@ -101,6 +101,13 @@ Monster::~Monster()
{
i->first->removeListener(&mTargetListener);
}
+
+ // free map position
+ if (getMap())
+ {
+ Point oldP = getPosition();
+ getMap()->getMap()->freeTile(oldP.x / 32, oldP.y / 32, getBlockType());
+ }
}
void Monster::perform()
@@ -293,6 +300,7 @@ int Monster::calculatePositionPriority(Point position, int targetPriority)
std::list<PATH_NODE> path;
path = getMap()->getMap()->findPath(thisPos.x / 32, thisPos.y / 32,
position.x / 32, position.y / 32,
+ getWalkMask(),
range);
if (path.empty() || path.size() >= range)