浏览代码

- Made battle_check_range fail whenever the distance between src/target is greater than the viewing range.

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

+ 2 - 0
Changelog-Trunk.txt

@@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
 2008/01/17
+	* Made battle_check_range fail whenever the distance between src/target is
+	  greater than the viewing range. [Skotlex]
 	* Icewalls can no longer be knocked back (see bugreport:38)
 2008/01/15
 	* Manner system fixing [ultramage]

+ 5 - 1
src/map/battle.c

@@ -3269,6 +3269,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
  *------------------------------------------*/
 bool battle_check_range(struct block_list *src,struct block_list *bl,int range)
 {
+	int d;
 	nullpo_retr(false, src);
 	nullpo_retr(false, bl);
 
@@ -3281,9 +3282,12 @@ bool battle_check_range(struct block_list *src,struct block_list *bl,int range)
 	if (!check_distance_bl(src, bl, range))
 		return false;
 
-	if(distance_bl(src, bl) < 2) //No need for path checking.
+	if((d=distance_bl(src, bl)) < 2) //No need for path checking.
 		return true;
 
+	if (d> AREA_SIZE)
+		return false; //Avoid targetting objects beyond your range of sight.
+
 	// ?áŠQ•¨”»’è
 	return path_search_long(NULL,src->m,src->x,src->y,bl->x,bl->y,CELL_CHKWALL);
 }