summaryrefslogtreecommitdiffstats
path: root/src/game-server/map.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-03-11 14:12:18 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-03-11 14:12:23 +0100
commitba57aa3eedf09f32a1ed003ce26ca54666796aef (patch)
treed91ea049c4e81c751112d1fede14db2209de5b41 /src/game-server/map.cpp
parentf066f988ac60571304b2301c57d5fbbf5da332cf (diff)
downloadmanaserv-ba57aa3eedf09f32a1ed003ce26ca54666796aef.tar.gz
manaserv-ba57aa3eedf09f32a1ed003ce26ca54666796aef.tar.xz
manaserv-ba57aa3eedf09f32a1ed003ce26ca54666796aef.zip
Moved freeing of map position to Actor destructor
It was done in both the Character and the Monster destructors, but I don't see how any Actor should be excluded from this. Now it also happens for NPC, Effect and Item, though only NPC has a relevant walkmask. Also fixed a small issue introduced in 97e0a9eb170499 and added an assert to freeTile. We should be able to assert that a tile can only be freed if it was blocked. Reviewed-by: Stefan Dombrowski
Diffstat (limited to 'src/game-server/map.cpp')
-rw-r--r--src/game-server/map.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/game-server/map.cpp b/src/game-server/map.cpp
index d48546a..16368e9 100644
--- a/src/game-server/map.cpp
+++ b/src/game-server/map.cpp
@@ -157,8 +157,9 @@ void Map::freeTile(int x, int y, BlockType type)
return;
MetaTile &metaTile = mMetaTiles[x + y * mWidth];
+ assert(metaTile.occupation[type] > 0);
- if (metaTile.occupation[type] > 0 && !(--metaTile.occupation[type]))
+ if (!(--metaTile.occupation[type]))
{
switch (type)
{