summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-29 16:01:02 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-29 16:01:02 +0000
commit6277250d56cf88f1ec22ac20816d887089ebda45 (patch)
treeb7416ccbbfbf054ed23687ce37073b5555db34f3 /src/map/mob.c
parent874e073947a9f3ef07f1d93338c0875a086afb85 (diff)
downloadhercules-6277250d56cf88f1ec22ac20816d887089ebda45.tar.gz
hercules-6277250d56cf88f1ec22ac20816d887089ebda45.tar.bz2
hercules-6277250d56cf88f1ec22ac20816d887089ebda45.tar.xz
hercules-6277250d56cf88f1ec22ac20816d887089ebda45.zip
- Added a division by zero check in mob_dead to prevent the (impossible) case where a mob dies with received damage of zero.
- Fixed compilation errors with SC_FLING... git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6821 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index f564878ea..677e7fbd3 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1768,10 +1768,12 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
double per; //Your share of the mob's exp
int bonus; //Bonus on top of your share.
- if (battle_config.exp_calc_type) // eAthena's exp formula based on max hp.
- per = (double)md->dmglog[i].dmg/(double)status->max_hp;
- else //jAthena's exp formula based on total damage.
+ if (!battle_config.exp_calc_type && md->tdmg)
+ //jAthena's exp formula based on total damage.
per = (double)md->dmglog[i].dmg/(double)md->tdmg;
+ else
+ //eAthena's exp formula based on max hp.
+ per = (double)md->dmglog[i].dmg/(double)status->max_hp;
if (count>1)
per *= (9.+(double)((count > 6)? 6:count))/10.; //attackers count bonus.