summaryrefslogtreecommitdiff
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
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
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/unit.c16
2 files changed, 15 insertions, 3 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index ef546b860..334194d91 100644
--- a/Changelog-Trunk.txt
+++ b/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/04/10
+ * Finished fixing the unit_data auto-chase update. Still need to do some
+ optimizations... but the current code-base should be usable. [Skotlex]
* Fixes to the unit_data update that lets characters auto-chase while
attacking. It seems to work mostly now, but there's still a few issues to
be resolved with ranged-attackers. [Skotlex]
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 { // マス目境界へ到着
+ } else {
if(ud->walkpath.path[ud->walkpath.path_pos]>=8)
return 1;
x = bl->x;