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.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 15cb12e6b..a7832a972 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -633,28 +633,18 @@ int mob_spawn (struct mob_data *md)
if (md->spawn) { //Respawn data
md->bl.m = md->spawn->m;
+ md->bl.x = md->spawn->x;
+ md->bl.y = md->spawn->y;
- if ((md->spawn->x == 0 && md->spawn->y == 0) || md->spawn->xs || md->spawn->ys)
+ if ((md->bl.x == 0 && md->bl.y == 0) || md->spawn->xs || md->spawn->ys)
{ //Monster can be spawned on an area.
- short x, y, xs, ys;
- if (md->spawn->x == 0 && md->spawn->y == 0)
- x = y = xs = ys = -1;
- else {
- x = md->spawn->x;
- y = md->spawn->y;
- xs = md->spawn->xs/2;
- ys = md->spawn->ys/2;
- }
- if (!map_search_freecell(NULL, md->spawn->m, &x, &y, xs, ys, battle_config.no_spawn_on_player?5:1)) {
+ if (!map_search_freecell(NULL, -1,
+ &md->bl.x, &md->bl.y, md->spawn->xs, md->spawn->ys,
+ battle_config.no_spawn_on_player?4:0)) {
// retry again later
add_timer(tick+5000,mob_delayspawn,md->bl.id,0);
return 1;
}
- md->bl.x = x;
- md->bl.y = y;
- } else {
- md->bl.x = md->spawn->x;
- md->bl.y = md->spawn->y;
}
}
memset(&md->state, 0, sizeof(md->state));