summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index a26726b21..36efd6614 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -888,6 +888,13 @@ int mob_spawn (struct mob_data *md)
md->bl.x = md->spawn->x;
md->bl.y = md->spawn->y;
+ if( map[md->spawn->m].users == 0 && md->spawn->state.dynamic )
+ {// cache the mob instead of spawning it
+ //FIXME: deleting 'md' is a potentially dangerous operation
+ unit_free(&md->bl,0);
+ return 0;
+ }
+
if ((md->bl.x == 0 && md->bl.y == 0) || md->spawn->xs || md->spawn->ys)
{ //Monster can be spawned on an area.
if (!map_search_freecell(&md->bl, -1,