summaryrefslogtreecommitdiff
path: root/src/game-server/map.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-03-15 00:01:09 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-03-15 00:01:09 +0000
commit68c0625ee9a3a01090f0bc93612bf84dd71eaa67 (patch)
treed1cd93e73bb2e5a2746f8cbd2c1cfac2c5dcce39 /src/game-server/map.cpp
parent4736ec595c1ed46f8b076f89bc31660ae21e9231 (diff)
downloadmanaserv-68c0625ee9a3a01090f0bc93612bf84dd71eaa67.tar.gz
manaserv-68c0625ee9a3a01090f0bc93612bf84dd71eaa67.tar.bz2
manaserv-68c0625ee9a3a01090f0bc93612bf84dd71eaa67.tar.xz
manaserv-68c0625ee9a3a01090f0bc93612bf84dd71eaa67.zip
Implemented script binding for controllig movement of beings and fixed a crash caused by the new blocking system (thanks to peavey for reporting).
Diffstat (limited to 'src/game-server/map.cpp')
-rw-r--r--src/game-server/map.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/game-server/map.cpp b/src/game-server/map.cpp
index c4f2c02e..ceb48b04 100644
--- a/src/game-server/map.cpp
+++ b/src/game-server/map.cpp
@@ -98,9 +98,12 @@ Map::setSize(int width, int height)
void Map::blockTile(int x, int y, BlockType type)
{
- if (type == BLOCKTYPE_NONE) return;
+ if (type == BLOCKTYPE_NONE || x < 0 || y < 0 || x >= mWidth || y >= mHeight)
+ {
+ return;
+ }
+
int tileNum = x + y * mWidth;
- assert (tileNum <= mWidth * mHeight);
if (++mOccupation[type][tileNum])
{
@@ -124,10 +127,12 @@ void Map::blockTile(int x, int y, BlockType type)
void Map::freeTile(int x, int y, BlockType type)
{
- if (type == BLOCKTYPE_NONE) return;
+ if (type == BLOCKTYPE_NONE || x < 0 || y < 0 || x >= mWidth || y >= mHeight)
+ {
+ return;
+ }
int tileNum = x + y * mWidth;
- assert (tileNum <= mWidth * mHeight);
if (!(--mOccupation[type][tileNum]))
{