diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-18 02:04:25 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-18 02:04:25 +0000 |
commit | 9f8f222a8dc995e03cb51ac827e790c5926b312d (patch) | |
tree | 65cf1b78893a3b9769d91b545b587466e24ed30e /src/map/mercenary.c | |
parent | 6f51acd64405e1f081e1a54a5c3f5c3b5431bc70 (diff) | |
download | hercules-9f8f222a8dc995e03cb51ac827e790c5926b312d.tar.gz hercules-9f8f222a8dc995e03cb51ac827e790c5926b312d.tar.bz2 hercules-9f8f222a8dc995e03cb51ac827e790c5926b312d.tar.xz hercules-9f8f222a8dc995e03cb51ac827e790c5926b312d.zip |
- Vaporize will no fail when the homun is dead.
- Corrected thhe double free issue that occurs when a homun dies and has no intimacy left.
- Fixed the charsave_method:1 saving/loading exp as signed ints rather than unsigned.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8335 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mercenary.c')
-rw-r--r-- | src/map/mercenary.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 3988ce27d..fff6a23f1 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -114,26 +114,25 @@ void merc_damage(struct homun_data *hd,struct block_list *src,int hp,int sp) int merc_hom_dead(struct homun_data *hd, struct block_list *src)
{
struct map_session_data *sd = hd->master;
+
+ clif_emotion(&hd->bl, 16) ; //wah
if (!sd)
- {
- clif_emotion(&hd->bl, 16) ; //wah
return 7;
- }
//Delete timers when dead.
merc_hom_hungry_timer_delete(hd);
sd->homunculus.hp = 0 ;
clif_hominfo(sd,hd,0); // Send dead flag
- if(!merc_hom_decrease_intimacy(hd, 100)) { // Intimacy was < 100
+ if(!merc_hom_decrease_intimacy(hd, 100)) // Intimacy was < 100
clif_emotion(&sd->bl, 23) ; //omg
- return 7; //Delete from memory.
+ else {
+ clif_emotion(&sd->bl, 28) ; //sob
+ clif_send_homdata(hd->master,SP_INTIMATE,hd->master->homunculus.intimacy / 100);
}
- clif_send_homdata(hd->master,SP_INTIMATE,hd->master->homunculus.intimacy / 100);
- clif_emotion(&hd->bl, 16) ; //wah
- clif_emotion(&sd->bl, 28) ; //sob
- return 3; //Remove from map.
+ //Remove from map (if it has no intimacy, it is auto-removed from memory)
+ return 3;
}
//Vaporize a character's homun. If flag, HP needs to be 80% or above.
@@ -147,6 +146,9 @@ int merc_hom_vaporize(struct map_session_data *sd, int flag) if (!hd || sd->homunculus.vaporize)
return 0;
+ if (status_isdead(&hd->bl))
+ return 0; //Can't vaporize a dead homun.
+
if (flag && hd->battle_status.hp < (hd->battle_status.max_hp*80/100))
return 0;
|