summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-17 09:46:31 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-17 09:46:31 +0000
commit3798baf5945874481cfdacbcd141feab07f3b9ed (patch)
tree439892c780f64810e5722c8a1f113ec980a68255 /src/map/battle.c
parentf1e4db40673f16acccc709d8176d45fba0c4e178 (diff)
downloadhercules-3798baf5945874481cfdacbcd141feab07f3b9ed.tar.gz
hercules-3798baf5945874481cfdacbcd141feab07f3b9ed.tar.bz2
hercules-3798baf5945874481cfdacbcd141feab07f3b9ed.tar.xz
hercules-3798baf5945874481cfdacbcd141feab07f3b9ed.zip
- Made battle_check_range fail whenever the distance between src/target is greater than the viewing range.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12084 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index e0d21f4ec..7912e71c8 100644
--- a/src/map/battle.c
+++ b/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);
}