From 2fa3554e3fb5dbc9227d343e667e6d6cd5423d1b Mon Sep 17 00:00:00 2001 From: zephyrus Date: Mon, 25 Aug 2008 19:41:27 +0000 Subject: - Fixed crash on Pet hatch. Resorted the way a Pet is initialized. (Bug Report 2121) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13134 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pet.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/map/pet.c b/src/map/pet.c index 3c3d33d1d..8c9ce1610 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -334,39 +334,39 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *pet) return 1; } sd->pd = pd = (struct pet_data *)aCalloc(1,sizeof(struct pet_data)); + pd->bl.type = BL_PET; + pd->bl.id = npc_get_new_npc_id(); + + pd->msd = sd; pd->petDB = &pet_db[i]; + pd->db = mob_db(pet->class_); memcpy(&pd->pet, pet, sizeof(struct s_pet)); + status_set_viewdata(&pd->bl, pet->class_); + unit_dataset(&pd->bl); + pd->ud.dir = sd->ud.dir; + pd->bl.m = sd->bl.m; pd->bl.x = sd->bl.x; pd->bl.y = sd->bl.y; unit_calc_pos(&pd->bl, sd->bl.x, sd->bl.y, sd->ud.dir); pd->bl.x = pd->ud.to_x; pd->bl.y = pd->ud.to_y; - pd->bl.id = npc_get_new_npc_id(); - pd->db = mob_db(pet->class_); - pd->bl.type = BL_PET; - pd->msd = sd; - status_set_viewdata(&pd->bl, pet->class_); - unit_dataset(&pd->bl); - pd->ud.dir = sd->ud.dir; - pd->last_thinktime = gettick(); map_addiddb(&pd->bl); - - // initialise status_calc_pet(pd,1); + pd->last_thinktime = gettick(); pd->state.skillbonus = 0; - if (battle_config.pet_status_support) //Skotlex + if( battle_config.pet_status_support ) run_script(pet_db[i].script,0,sd->bl.id,0); - if(battle_config.pet_hungry_delay_rate != 100) + if( battle_config.pet_hungry_delay_rate != 100 ) interval = (pd->petDB->hungry_delay*battle_config.pet_hungry_delay_rate)/100; else interval = pd->petDB->hungry_delay; - if(interval <= 0) + if( interval <= 0 ) interval = 1; - pd->pet_hungry_timer = add_timer(gettick()+interval,pet_hungry,sd->bl.id,0); + pd->pet_hungry_timer = add_timer(gettick() + interval, pet_hungry, sd->bl.id, 0); return 0; } -- cgit v1.2.3-60-g2f50