summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-11 02:32:30 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-11 02:32:30 +0000
commitc31d5fe703c5ab30a398ef7da9059f4e20b7891d (patch)
treefd660a16a5f810ff3b26682a4ea5a8dc2d904825 /src
parent4fec7fb11ff316e837be25e07ae427d8aa7df460 (diff)
downloadhercules-c31d5fe703c5ab30a398ef7da9059f4e20b7891d.tar.gz
hercules-c31d5fe703c5ab30a398ef7da9059f4e20b7891d.tar.bz2
hercules-c31d5fe703c5ab30a398ef7da9059f4e20b7891d.tar.xz
hercules-c31d5fe703c5ab30a398ef7da9059f4e20b7891d.zip
- Finished fixing the unit_data auto-case update. Still need to do some optimizations... but the current code-base should be usable.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5981 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/unit.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index fe2b51b1f..dd3f1ef4c 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -59,13 +59,23 @@ int unit_walktoxy_sub(struct block_list *bl)
if (ud->walktarget && ud->chaserange >0) {
//Trim the last part of the path to account for range.
- for (i = 1; i <= ud->chaserange && ud->walkpath.path_len>0; i++) {
+ for (i = ud->chaserange*10; i > 0 && ud->walkpath.path_len>0;) {
int dir;
ud->walkpath.path_len--;
dir = ud->walkpath.path[ud->walkpath.path_len];
+ if(dir&1)
+ i-=14;
+ else
+ i-=10;
ud->to_x -= dirx[dir];
ud->to_y -= diry[dir];
}
+ if (!ud->walkpath.path_len) {
+ //Already within requested range.
+ if (ud->attacktarget == ud->walktarget)
+ unit_attack(bl, ud->attacktarget, ud->state.attack_continue);
+ return 0;
+ }
}
ud->state.change_walk_target=0;
@@ -80,7 +90,7 @@ int unit_walktoxy_sub(struct block_list *bl)
i = status_get_speed(bl)*14/10;
else
i = status_get_speed(bl);
- if( i > 0) {
+ if( i > 0) {
i = i>>1;
ud->walktimer = add_timer(gettick()+i,unit_walktoxy_timer,bl->id,0);
}
@@ -131,7 +141,7 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data)
unit_walktoxy_sub(bl);
return 0;
}
- } else { // �}�X�ڋ��E�֓���
+ } else {
if(ud->walkpath.path[ud->walkpath.path_pos]>=8)
return 1;
x = bl->x;