summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuzZza <LuzZza@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-18 17:00:54 +0000
committerLuzZza <LuzZza@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-18 17:00:54 +0000
commit39bb97c96288dd38e406affe4264f84a3a135ce7 (patch)
treebf2fd03bfaaed69018079374e68de46e315079a2
parent55af5ea9f16c710fd5c1685aeab5203098bd598c (diff)
downloadhercules-39bb97c96288dd38e406affe4264f84a3a135ce7.tar.gz
hercules-39bb97c96288dd38e406affe4264f84a3a135ce7.tar.bz2
hercules-39bb97c96288dd38e406affe4264f84a3a135ce7.tar.xz
hercules-39bb97c96288dd38e406affe4264f84a3a135ce7.zip
Added MEXP overflow checks.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10287 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/mob.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 3ab801d7b..a668f7bfc 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/04/18
+ * Added MEXP overflow checks. [LuzZza]
* Added bonus5 bAutoSpell/bAutoSpellWhenHit. The new parameter is used to
specify when the spell should trigger (melee/range + weapon/magic/misc
attack), see doc/item_bonus.txt for details. [Skotlex]
diff --git a/src/map/mob.c b/src/map/mob.c
index 2b92438c3..e211faf2e 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3321,7 +3321,10 @@ int mob_parse_dbrow(char** str)
status_calc_misc(&data.bl, status, db->lv);
// MVP EXP Bonus, Chance: MEXP,ExpPer
- db->mexp = atoi(str[30]) * battle_config.mvp_exp_rate / 100;
+ // Some new MVP's MEXP multipled by high exp-rate cause overflow. [LuzZza]
+ exp = (double)atoi(str[30]) * (double)battle_config.mvp_exp_rate / 100.;
+ db->mexp = (unsigned int)cap_value(exp, 0, UINT_MAX);
+
db->mexpper = atoi(str[31]);
//Now that we know if it is an mvp or not, apply battle_config modifiers [Skotlex]