From 66be3d8e66260ca148d768b887695729ded98abb Mon Sep 17 00:00:00 2001 From: skotlex Date: Sat, 22 Dec 2007 18:08:37 +0000 Subject: - Corrected mob spawn utilization of the delay1/delay2 values (one is respawn delay base, the second is random variance added on top of it). Cleaned up related code. - Changed abit map_add_block to prevent adding a player object which is invalid (not authed, waiting to be disconnected) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11964 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/map/map.c') diff --git a/src/map/map.c b/src/map/map.c index e3c5aacbe..6050d6ed4 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -349,10 +349,6 @@ int map_addblock_sub (struct block_list *bl, int flag) return 1; } -#ifdef CELL_NOSTACK - map_addblcell(bl); -#endif - pos = x/BLOCK_SIZE+(y/BLOCK_SIZE)*map[m].bxs; if (bl->type == BL_MOB) { bl->next = map[m].block_mob[pos]; @@ -361,14 +357,13 @@ int map_addblock_sub (struct block_list *bl, int flag) map[m].block_mob[pos] = bl; map[m].block_mob_count[pos]++; } else { - bl->next = map[m].block[pos]; - bl->prev = &bl_head; - if (bl->next) bl->next->prev = bl; - map[m].block[pos] = bl; - map[m].block_count[pos]++; if (bl->type == BL_PC && flag) { struct map_session_data* sd; + if (!sd->state.auth) { + ShowError("map_addblock: Attempted to add a non-authed player (%d:%d)!\n", sd->status.account_id, sd->status.char_id); + return 1; + } if (map[m].users++ == 0 && battle_config.dynamic_mobs) //Skotlex map_spawnmobs(m); sd = (struct map_session_data*)bl; @@ -378,8 +373,17 @@ int map_addblock_sub (struct block_list *bl, int flag) pet_menu(sd, 3); //Option 3 is return to egg. } } + bl->next = map[m].block[pos]; + bl->prev = &bl_head; + if (bl->next) bl->next->prev = bl; + map[m].block[pos] = bl; + map[m].block_count[pos]++; } +#ifdef CELL_NOSTACK + map_addblcell(bl); +#endif + return 0; } -- cgit v1.2.3-60-g2f50