diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-22 21:24:40 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-22 21:24:40 +0000 |
commit | 4161c99f71fbd824163356c642731f7599c291e2 (patch) | |
tree | f4098c0066600ad4ab860ce42e0ac8c439ce142a /src/map/mob.c | |
parent | 66be3d8e66260ca148d768b887695729ded98abb (diff) | |
download | hercules-4161c99f71fbd824163356c642731f7599c291e2.tar.gz hercules-4161c99f71fbd824163356c642731f7599c291e2.tar.bz2 hercules-4161c99f71fbd824163356c642731f7599c291e2.tar.xz hercules-4161c99f71fbd824163356c642731f7599c291e2.zip |
Fixed droprate overflows when going over rate 2000x
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11966 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 9830dff0e..d5105597f 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -3178,16 +3178,19 @@ static int mob_makedummymobdb(int class_) } //Adjusts the drop rate of item according to the criteria given. [Skotlex] -static unsigned int mob_drop_adjust(int rate, int rate_adjust, unsigned short rate_min, unsigned short rate_max) +static unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned short rate_min, unsigned short rate_max) { + double rate = baserate; + if (battle_config.logarithmic_drops && rate_adjust > 0) //Logarithmic drops equation by Ishizu-Chan //Equation: Droprate(x,y) = x * (5 - log(x)) ^ (ln(y) / ln(5)) //x is the normal Droprate, y is the Modificator. - rate = (int)(rate * pow((5.0 - log10(rate)), (log(rate_adjust/100.) / log(5.0))) + 0.5); + rate = rate * pow((5.0 - log10(rate)), (log(rate_adjust/100.) / log(5.0))) + 0.5; else //Classical linear rate adjustment. rate = rate * rate_adjust/100; - return cap_value(rate,rate_min,rate_max); + + return (unsigned int)cap_value(rate,rate_min,rate_max); } /*========================================== |