diff options
author | toms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-15 22:30:10 +0000 |
---|---|---|
committer | toms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-15 22:30:10 +0000 |
commit | 3a734c4ca7ee16ca6d0e4e5805606f83d21b14c4 (patch) | |
tree | f0db0e92b144de1ae61ef6f5d9364f7f7fe37f20 /src/map/mercenary.c | |
parent | 6457ffcc63e196af5458298be8c02b8195835356 (diff) | |
download | hercules-3a734c4ca7ee16ca6d0e4e5805606f83d21b14c4.tar.gz hercules-3a734c4ca7ee16ca6d0e4e5805606f83d21b14c4.tar.bz2 hercules-3a734c4ca7ee16ca6d0e4e5805606f83d21b14c4.tar.xz hercules-3a734c4ca7ee16ca6d0e4e5805606f83d21b14c4.zip |
Homunc Timers should be disabled when the homunc is vaporized or dead an re-enabled on call/resu
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8305 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mercenary.c')
-rw-r--r-- | src/map/mercenary.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 892bffd47..7270f9dd8 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -769,15 +769,6 @@ int merc_hom_create(struct map_session_data *sd) sd->hd = hd = (struct homun_data *)aCalloc(1,sizeof(struct homun_data));
hd->homunculusDB = &homunculus_db[i];
hd->master = sd;
- return merc_hom_data_init(sd);
-}
-
-int merc_hom_data_init(struct map_session_data *sd)
-{
- struct homun_data * hd = sd->hd;
- int i;
-
- nullpo_retr(1, hd);
hd->bl.m=sd->bl.m;
hd->bl.x=sd->bl.x;
@@ -819,12 +810,21 @@ int merc_hom_data_init(struct map_session_data *sd) status_calc_homunculus(hd,1);
// Timers
- hd->hungry_timer = add_timer(gettick()+hd->homunculusDB->hungryDelay,merc_hom_hungry,hd->master->bl.id,0);
- 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);
+ merc_hom_init_timers(hd);
return 0;
}
+void merc_hom_init_timers(struct homun_data * hd)
+{
+ if (hd->hungry_timer == -1)
+ 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);
+ }
+}
+
int merc_call_homunculus(struct map_session_data *sd, short x, short y)
{
struct homun_data *hd;
@@ -833,11 +833,13 @@ int merc_call_homunculus(struct map_session_data *sd, short x, short y) return merc_create_homunculus(sd, 6000 + rand(1, 8)) ;
if (!sd->homunculus.vaporize)
- return 0; //Can't use this when homun was vaporized.
+ return 0; //Can't use this if homun wasn't vaporized.
// If homunc not yet loaded, load it
if (!sd->hd)
merc_hom_create(sd);
+ else
+ merc_hom_init_timers(sd->hd);
hd = sd->hd;
sd->homunculus.vaporize = 0;
@@ -942,6 +944,8 @@ int merc_revive_homunculus(struct map_session_data *sd, unsigned char per, short if (!sd->hd) //Load homun data;
merc_hom_create(sd);
+ else
+ merc_hom_init_timers(sd->hd);
hd = sd->hd;
|