summaryrefslogtreecommitdiff
path: root/src/game-server/mapcomposite.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-06-30 15:01:50 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-06-30 15:01:50 +0000
commitd7e84be1d3dc935f47cefc0f600ced74f37e46fb (patch)
treef535b6b4130994a9162c48f8c556b0dd5ddc9a5f /src/game-server/mapcomposite.cpp
parentfd392c16c0a1236ca4ea124b5ebbd309df1c5064 (diff)
downloadmanaserv-d7e84be1d3dc935f47cefc0f600ced74f37e46fb.tar.gz
manaserv-d7e84be1d3dc935f47cefc0f600ced74f37e46fb.tar.bz2
manaserv-d7e84be1d3dc935f47cefc0f600ced74f37e46fb.tar.xz
manaserv-d7e84be1d3dc935f47cefc0f600ced74f37e46fb.zip
Implemented basic monster AI and fixed a stability problem caused by the spawn areas.
Diffstat (limited to 'src/game-server/mapcomposite.cpp')
-rw-r--r--src/game-server/mapcomposite.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp
index 5ca2330b..027db924 100644
--- a/src/game-server/mapcomposite.cpp
+++ b/src/game-server/mapcomposite.cpp
@@ -29,6 +29,8 @@
#include "game-server/mapcomposite.hpp"
#include "game-server/character.hpp"
+#include "utils/logger.h"
+
/* TODO: Implement overlapping map zones instead of strict partitioning.
Purpose: to decrease the number of zone changes, as overlapping allows for
hysteresis effect and prevents an object from changing zone each server
@@ -481,6 +483,7 @@ bool MapComposite::insert(Thing *ptr)
zones[(pos.x / zoneDiam) + (pos.y / zoneDiam) * mapWidth].insert(obj);
}
+ ptr->setMap(this);
things.push_back(ptr);
return true;
}
@@ -514,6 +517,8 @@ void MapComposite::remove(Thing *ptr)
void MapComposite::update()
{
+ map->resetTempWalk();
+
for (int i = 0; i < mapHeight * mapWidth; ++i)
{
zones[i].destinations.clear();
@@ -531,6 +536,9 @@ void MapComposite::update()
Point const &pos1 = obj->getOldPosition(),
&pos2 = obj->getPosition();
+
+ map->setTempWalk(pos2.x / 32, pos2.y / 32, false);
+
int src = (pos1.x / zoneDiam) + (pos1.y / zoneDiam) * mapWidth,
dst = (pos2.x / zoneDiam) + (pos2.y / zoneDiam) * mapWidth;
if (src != dst)