summaryrefslogtreecommitdiff
path: root/src/map/mercenary.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-21 03:38:14 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-21 03:38:14 +0000
commit04787d3f8e5502c2f33212f23ab6b549e8b953a3 (patch)
treef7a098328c47fa5fa1d6c1859cd4e1fc51d9fc80 /src/map/mercenary.c
parent04238bbdaf79e256a3dc7a8dd4253293e9610fc0 (diff)
downloadhercules-04787d3f8e5502c2f33212f23ab6b549e8b953a3.tar.gz
hercules-04787d3f8e5502c2f33212f23ab6b549e8b953a3.tar.bz2
hercules-04787d3f8e5502c2f33212f23ab6b549e8b953a3.tar.xz
hercules-04787d3f8e5502c2f33212f23ab6b549e8b953a3.zip
- Some minor cleanups
- Fixed the Homunc not spawning next to you after receiving it's data from the char-server. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9035 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mercenary.c')
-rw-r--r--src/map/mercenary.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index f027d9234..32a2e9f97 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -537,9 +537,19 @@ int merc_hom_alloc(struct map_session_data *sd, struct s_homunculus *hom)
return 1;
}
sd->hd = hd = aCalloc(1,sizeof(struct homun_data));
+ hd->bl.subtype = MONS;
+ hd->bl.type = BL_HOM;
+ hd->bl.id = npc_get_new_npc_id();
+
+ hd->master = sd;
hd->homunculusDB = &homunculus_db[i];
memcpy(&hd->homunculus, hom, sizeof(struct s_homunculus));
- hd->master = sd;
+ hd->exp_next = hexptbl[hd->homunculus.level - 1];
+
+ status_set_viewdata(&hd->bl, hd->homunculus.class_);
+ status_change_init(&hd->bl);
+ unit_dataset(&hd->bl);
+ hd->ud.dir = sd->ud.dir;
// Find a random valid pos around the player
hd->bl.m = sd->bl.m;
@@ -550,18 +560,6 @@ int merc_hom_alloc(struct map_session_data *sd, struct s_homunculus *hom)
map_random_dir(&hd->bl, &x, &y);
hd->bl.x = x;
hd->bl.y = y;
-
- hd->bl.subtype = MONS;
- hd->bl.type = BL_HOM;
- hd->bl.id = npc_get_new_npc_id();
- hd->bl.prev = NULL;
- hd->bl.next = NULL;
- hd->exp_next = hexptbl[hd->homunculus.level - 1];
-
- status_set_viewdata(&hd->bl, hd->homunculus.class_);
- status_change_init(&hd->bl);
- unit_dataset(&hd->bl);
- hd->ud.dir = sd->ud.dir;
map_addiddb(&hd->bl);
status_calc_homunculus(hd,1);
@@ -644,17 +642,15 @@ int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag)
merc_hom_alloc(sd, sh);
hd = sd->hd;
- if(hd->homunculus.hp && !hd->homunculus.vaporize)
+ if(hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == NULL)
{
- if (hd->bl.prev != NULL) {
- map_addblock(&hd->bl);
- clif_spawn(&hd->bl);
- clif_hominfo(sd,hd,1);
- clif_hominfo(sd,hd,0); // send this x2. dunno why, but kRO does that [blackhole89]
- clif_homskillinfoblock(sd);
- clif_hominfo(sd,hd,0);
- clif_send_homdata(sd,SP_ACK,0);
- }
+ map_addblock(&hd->bl);
+ clif_spawn(&hd->bl);
+ clif_hominfo(sd,hd,1);
+ clif_hominfo(sd,hd,0); // send this x2. dunno why, but kRO does that [blackhole89]
+ clif_homskillinfoblock(sd);
+ clif_hominfo(sd,hd,0);
+ clif_send_homdata(sd,SP_ACK,0);
}
return 1;
}