diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/mob.c | 7 | ||||
-rw-r--r-- | src/map/npc.c | 2 |
2 files changed, 8 insertions, 1 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, diff --git a/src/map/npc.c b/src/map/npc.c index 68b979a28..58cfac285 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2335,7 +2335,7 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c data = aMalloc(sizeof(struct spawn_data)); memcpy(data, &mob, sizeof(struct spawn_data)); - if( !battle_config.dynamic_mobs || data->delay1 || data->delay2 ) { + if( !battle_config.dynamic_mobs ) { data->state.dynamic = false; npc_parse_mob2(data); npc_delay_mob += data->num; |