From b22fc5f3a8752fc93b37e7ee2a3cbeaacec3aee7 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 15 Aug 2006 23:39:12 +0000 Subject: - Moved the deletion of timers from unit_remove_map to the homun vaporize/dead routines since unit_remove_map is also invoked whenever you warp or change maps. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8309 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/mercenary.c | 8 +++++++- src/map/unit.c | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 0ed0f891c..f63a75766 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -120,6 +120,9 @@ int merc_hom_dead(struct homun_data *hd, struct block_list *src) return 7; } + //Delete timers when dead. + merc_hom_hungry_timer_delete(hd); + merc_natural_heal_timer_delete(hd); sd->homunculus.hp = 0 ; clif_hominfo(sd,hd,0); // Send dead flag @@ -148,6 +151,9 @@ int merc_hom_vaporize(struct map_session_data *sd, int flag) if (flag && hd->battle_status.hp < (hd->battle_status.max_hp*80/100)) return 0; + //Delete timers when vaporized. + merc_hom_hungry_timer_delete(hd); + merc_natural_heal_timer_delete(hd); sd->homunculus.vaporize = 1; clif_hominfo(sd, sd->hd, 0); merc_save(hd); @@ -813,7 +819,6 @@ void merc_hom_init_timers(struct homun_data * hd) hd->hungry_timer = add_timer(gettick()+hd->homunculusDB->hungryDelay,merc_hom_hungry,hd->master->bl.id,0); if (hd->natural_heal_timer == -1) { - natural_heal_prev_tick = gettick(); hd->natural_heal_timer = add_timer(gettick()+battle_config.natural_healhp_interval, merc_natural_heal,hd->master->bl.id,0); } } @@ -1115,6 +1120,7 @@ int do_init_merc (void) memset(homunculus_db,0,sizeof(homunculus_db)); //[orn] read_homunculusdb(); //[orn] // Add homunc timer function to timer func list [Toms] + natural_heal_prev_tick = gettick(); add_timer_func_list(merc_natural_heal, "merc_natural_heal"); add_timer_func_list(merc_hom_hungry, "merc_hom_hungry"); return 0; diff --git a/src/map/unit.c b/src/map/unit.c index 1b7b67c11..b70c88a97 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1595,8 +1595,6 @@ int unit_remove_map(struct block_list *bl, int clrtype) { } else if (bl->type == BL_HOM) { struct homun_data *hd = (struct homun_data *) bl; struct map_session_data *sd = hd->master; - merc_hom_hungry_timer_delete(hd); - merc_natural_heal_timer_delete(hd); if(!sd || !sd->homunculus.intimacy) { //He's going to be deleted. clif_emotion(bl, 28) ; //sob -- cgit v1.2.3-70-g09d2