summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authortoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-10 23:34:35 +0000
committertoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-10 23:34:35 +0000
commit1da444ee4f4c92bc69c9e2e897e0bf4674e52bc8 (patch)
tree0d86857c93f00868dc755cd6332516fa41fb01d0 /src/map/unit.c
parentaa8f497e6714b4f93c6ea81a99ebd96d0c3501ef (diff)
downloadhercules-1da444ee4f4c92bc69c9e2e897e0bf4674e52bc8.tar.gz
hercules-1da444ee4f4c92bc69c9e2e897e0bf4674e52bc8.tar.bz2
hercules-1da444ee4f4c92bc69c9e2e897e0bf4674e52bc8.tar.xz
hercules-1da444ee4f4c92bc69c9e2e897e0bf4674e52bc8.zip
Code cleanup on homunc, they stay in memory until player disconnect or homunc destruction
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8241 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index c9a7c5176..d7c512714 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1605,6 +1605,30 @@ int unit_remove_map(struct block_list *bl, int clrtype) {
map_freeblock_unlock();
return 0;
}
+ } else if (bl->type == BL_HOM) {
+ struct homun_data *hd = (struct homun_data *) bl;
+ struct map_session_data *sd = hd->master;
+
+ // Desactive timers
+ merc_hom_hungry_timer_delete(hd);
+ merc_natural_heal_timer_delete(hd);
+
+ if(!sd) {
+ map_delblock(bl);
+ unit_free(bl);
+ map_freeblock_unlock();
+ return 0;
+ }
+
+ // Homunc was deleted or player is leaving the server, remove it from memory
+ if (sd->homunculus.hom_id == 0 || sd->state.waitingdisconnect)
+ { //Remove pet.
+ map_delblock(bl);
+ unit_free(bl);
+ sd->hd = NULL;
+ map_freeblock_unlock();
+ return 1;
+ }
}
map_delblock(bl);
map_freeblock_unlock();
@@ -1770,16 +1794,6 @@ int unit_free(struct block_list *bl) {
}
if(mob_is_clone(md->class_))
mob_clone_delete(md->class_);
- } else if( bl->type == BL_HOM ) { //[orn]
- 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) {
-// if(hd->intimacy > 0)
-// intif_save_mercdata(sd->status.account_id,&sd->hom);
- sd->hd = NULL;
- }
}
skill_clear_unitgroup(bl);