From efe4ef65bedbaa66e35f3a4354f7422c313ce624 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Thu, 13 Mar 2008 07:29:01 +0000 Subject: Implemented dynamic and selective pathblocking. Monsters are blocked by player characters and other monsters, player characters only by monsters. --- src/game-server/spawnarea.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/game-server/spawnarea.cpp') diff --git a/src/game-server/spawnarea.cpp b/src/game-server/spawnarea.cpp index abc1657..3054a0a 100644 --- a/src/game-server/spawnarea.cpp +++ b/src/game-server/spawnarea.cpp @@ -79,15 +79,16 @@ SpawnArea::update() height = realMap->getHeight() * 32; } + Being *being = new Monster(mSpecy); + do { position = Point(x + rand() % width, y + rand() % height); c--; - } while (!realMap->getWalk(position.x / 32, position.y / 32) && c); + } while (!realMap->getWalk(position.x / 32, position.y / 32, being->getWalkMask()) && c); if (c) { - Being *being = new Monster(mSpecy); being->addListener(&mSpawnedListener); being->setMap(map); @@ -103,6 +104,7 @@ SpawnArea::update() << mSpecy->getType() << " on map " << map->getName() << " (" << x << ',' << y << ',' << width << ',' << height << ')'); + delete being; } } } -- cgit