diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-08-25 19:41:27 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-08-25 19:41:27 +0000 |
commit | 2fa3554e3fb5dbc9227d343e667e6d6cd5423d1b (patch) | |
tree | 76564b935b6e1c5a59ae792d1fb0682a959b0313 /src/map/pet.c | |
parent | 6e546d5b1857dae13937adb2d6ddb0013c1760b9 (diff) | |
download | hercules-2fa3554e3fb5dbc9227d343e667e6d6cd5423d1b.tar.gz hercules-2fa3554e3fb5dbc9227d343e667e6d6cd5423d1b.tar.bz2 hercules-2fa3554e3fb5dbc9227d343e667e6d6cd5423d1b.tar.xz hercules-2fa3554e3fb5dbc9227d343e667e6d6cd5423d1b.zip |
- 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
Diffstat (limited to 'src/map/pet.c')
-rw-r--r-- | src/map/pet.c | 28 |
1 files 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; } |