From 6277250d56cf88f1ec22ac20816d887089ebda45 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 29 May 2006 16:01:02 +0000 Subject: - 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 --- src/map/mob.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/map/mob.c') 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. -- cgit v1.2.3-60-g2f50