summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2007-09-10 08:13:21 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2007-09-10 08:13:21 +0000
commitfab7e6acc11c30ab240300c81b01eec128b330fc (patch)
tree641ca0f551a5ac41aec99623fb9f7872e3852bd7 /src
parent0c52964be1d7158bf6533011b4e08287608a6926 (diff)
downloadmanaserv-fab7e6acc11c30ab240300c81b01eec128b330fc.tar.gz
manaserv-fab7e6acc11c30ab240300c81b01eec128b330fc.tar.bz2
manaserv-fab7e6acc11c30ab240300c81b01eec128b330fc.tar.xz
manaserv-fab7e6acc11c30ab240300c81b01eec128b330fc.zip
Dimensionless spawn points now spawn over the whole map.
Diffstat (limited to 'src')
-rw-r--r--src/game-server/spawnarea.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/game-server/spawnarea.cpp b/src/game-server/spawnarea.cpp
index 63bdc904..5cc1f39f 100644
--- a/src/game-server/spawnarea.cpp
+++ b/src/game-server/spawnarea.cpp
@@ -60,15 +60,17 @@ SpawnArea::update()
if (mNextSpawn == 0)
{
- //find a free spawn location. Give up after 10 tries
+ // Find a free spawn location. Give up after 10 tries
int c = 10;
Point position;
MapComposite *map = getMap();
Map *realMap = map->getMap();
+ int width = mZone.w == 0 ? realMap->getWidth() : mZone.w;
+ int height = mZone.h == 0 ? realMap->getHeight() : mZone.h;
do
{
- position = Point(mZone.x + rand() % mZone.w,
- mZone.y + rand() % mZone.h);
+ position = Point(mZone.x + rand() % width,
+ mZone.y + rand() % height);
c--;
} while (!realMap->getWalk(position.x / 32, position.y / 32) && c);