浏览代码

- Fixed a possible crash when you dual-wield and the total damage is 0.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7880 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 年之前
父节点
当前提交
3fc64fbe0a
共有 2 个文件被更改,包括 5 次插入4 次删除
  1. 2 0
      Changelog-Trunk.txt
  2. 3 4
      src/map/battle.c

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ 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.
 
 2006/07/25
+	* Fixed a possible crash when you dual-wield and the total damage is 0.
+	  [Skotlex]
 	* Added Toms's perl scripts item_db.pl and mob_db.pl (they are in tools/),
 	  they convert the txt databases into sql. [Skotlex]
 	- Usage: "script" < "input file" > "output file". eg: ./tools/item_db.pl < db/item_db.txt > sql-files/item_db.sql

+ 3 - 4
src/map/battle.c

@@ -1944,8 +1944,8 @@ static struct Damage battle_calc_weapon_attack(
 	if(!flag.lh && wd.damage2)
 		wd.damage2=0;
 	
-	if(wd.damage > 0 || wd.damage2 > 0)
-	{
+	if(wd.damage + wd.damage2)
+	{	//There is a total damage value
 		if(!wd.damage2) {
 			wd.damage=battle_calc_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
 			if (map_flag_gvg(target->m))
@@ -1955,8 +1955,7 @@ static struct Damage battle_calc_weapon_attack(
 			wd.damage2=battle_calc_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
 			if (map_flag_gvg(target->m))
 				wd.damage2=battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
-		}
-		else
+		} else
 		{
 			int d1=wd.damage+wd.damage2,d2=wd.damage2;
 			wd.damage=battle_calc_damage(src,target,d1,wd.div_,skill_num,skill_lv,wd.flag);