summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-26 23:17:25 +0000
committerLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-26 23:17:25 +0000
commit928255a64e330f1cd949742b343284a6b6f06b4b (patch)
treec97072ce3adaff421fd0ab4fbf5dc981e42e521e /src
parent6d0e731fdfaa4127bc47f4e769d0cc6e61e4c2a0 (diff)
downloadhercules-928255a64e330f1cd949742b343284a6b6f06b4b.tar.gz
hercules-928255a64e330f1cd949742b343284a6b6f06b4b.tar.bz2
hercules-928255a64e330f1cd949742b343284a6b6f06b4b.tar.xz
hercules-928255a64e330f1cd949742b343284a6b6f06b4b.zip
li'l optimization of Cloaking check
(optimized the order of checking cells, added break; if found a wrong cell = faster) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@374 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/skill.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index f1d58f8c8..ed0521aec 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -9950,8 +9950,8 @@ int skill_status_change_clear(struct block_list *bl, int type)
/* クロ?キング?査(周りに移動不可能地?があるか) */
int skill_check_cloaking(struct block_list *bl)
{
- static int dx[]={-1, 0, 1,-1, 1,-1, 0, 1};
- static int dy[]={-1,-1,-1, 0, 0, 1, 1, 1};
+ static int dx[]={ 0, 1, 0, -1, -1, 1, 1, -1}; //optimized by Lupus
+ static int dy[]={-1, 0, 1, 0, -1, -1, 1, 1};
int end=1,i;
//missing sd [Found by Celest, commited by Aria]
@@ -9965,7 +9965,10 @@ int skill_check_cloaking(struct block_list *bl)
return 0;
for(i=0;i<sizeof(dx)/sizeof(dx[0]);i++){
int c=map_getcell(bl->m,bl->x+dx[i],bl->y+dy[i]);
- if(c==1 || c==5) end=0;
+ if(c==1 || c==5) {
+ end=0;
+ break;
+ }
}
if(end){
if ((bl->type == BL_PC && pc_checkskill(sd,AS_CLOAKING)<3) || bl->type == BL_MOB) {
@@ -9988,9 +9991,9 @@ int skill_check_cloaking(struct block_list *bl)
int skill_type_cloaking(struct block_list *bl)
{
- static int dx[]={-1, 0, 1,-1, 1,-1, 0, 1};
- static int dy[]={-1,-1,-1, 0, 0, 1, 1, 1};
- int end=1,i;
+ static int dx[]={ 0, 1, 0, -1, -1, 1, 1, -1}; //optimized by Lupus
+ static int dy[]={-1, 0, 1, 0, -1, -1, 1, 1};
+ int i;
nullpo_retr(0, bl);
if(bl->type == BL_PC && battle_config.pc_cloak_check_type&1)
@@ -10000,9 +10003,10 @@ int skill_type_cloaking(struct block_list *bl)
for(i=0; i<sizeof(dx)/sizeof(dx[0]); i++)
{
int c=map_getcell(bl->m,bl->x+dx[i],bl->y+dy[i]);
- if(c==1 || c==5) end=0;
+ if(c==1 || c==5)
+ return 0;
}
- return end;
+ return 1;
}
/*