소스 검색

Fixed droprate overflows when going over rate 2000x

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11966 54d463be-8e91-2dee-dedb-b68131a5f0ec
ultramage 17 년 전
부모
커밋
f9c52aa0aa
2개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 0
      Changelog-Trunk.txt
  2. 6 3
      src/map/mob.c

+ 1 - 0
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.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
 2007/12/22
 2007/12/22
+	* Fixed droprate overflows when going over rate 2000x [ultramage]
 	* Corrected mob spawn utilization of the delay1/delay2 values (one is
 	* Corrected mob spawn utilization of the delay1/delay2 values (one is
 	  respawn delay base, the second is random variance added on top of it).
 	  respawn delay base, the second is random variance added on top of it).
 	  Cleaned up related code. [Skotlex]
 	  Cleaned up related code. [Skotlex]

+ 6 - 3
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]
 //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
 	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))
 		//Equation: Droprate(x,y) = x * (5 - log(x)) ^ (ln(y) / ln(5))
 		//x is the normal Droprate, y is the Modificator.
 		//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
 	else
 		//Classical linear rate adjustment.
 		//Classical linear rate adjustment.
 		rate = rate * rate_adjust/100;
 		rate = rate * rate_adjust/100;
-	return cap_value(rate,rate_min,rate_max);
+
+	return (unsigned int)cap_value(rate,rate_min,rate_max);
 }
 }
 
 
 /*==========================================
 /*==========================================