summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-11 16:52:52 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-11 16:52:52 +0000
commitf86486582880042ecbed0e0c6977e98e9dd3002c (patch)
tree2f8997f22b95c0fe5f48659ea7b930fc14f263d4
parentc67c8b9fbdb009880f26d8c8baf8b76f27cf4885 (diff)
downloadhercules-f86486582880042ecbed0e0c6977e98e9dd3002c.tar.gz
hercules-f86486582880042ecbed0e0c6977e98e9dd3002c.tar.bz2
hercules-f86486582880042ecbed0e0c6977e98e9dd3002c.tar.xz
hercules-f86486582880042ecbed0e0c6977e98e9dd3002c.zip
- Modified unit_walktoxy_sub to always move at least one cell when a large chaserange is specified to prevent possible infinite loops where attack_timer says you are not within range, but unit_walktoxy says you are.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5987 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/map/unit.c15
2 files changed, 9 insertions, 10 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 9da5a4256..d20071a0e 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,10 @@ 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/11
+ * Modified unit_walktoxy_sub to always move at least one cell when a large
+ chaserange is specified to prevent possible infinite loops where
+ attack_timer says you are not within range, but unit_walktoxy says you are.
+ [Skotlex]
* Fixed Looted items always dropping in quantities of one. [Skotlex]
* Removed the check that deletes Magnus Exorcism cells after they hit once.
[Skotlex]
diff --git a/src/map/unit.c b/src/map/unit.c
index 47bae59a4..b828f721c 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -58,9 +58,10 @@ int unit_walktoxy_sub(struct block_list *bl)
memcpy(&ud->walkpath,&wpd,sizeof(wpd));
if (ud->target && ud->chaserange >0) {
- //Trim the last part of the path to account for range.
- for (i = ud->chaserange*10; i > 0 && ud->walkpath.path_len>0;) {
- int dir;
+ int dir;
+ //Trim the last part of the path to account for range,
+ //but always move at least one cell when requested to move.
+ for (i = ud->chaserange*10; i > 0 && ud->walkpath.path_len>1;) {
ud->walkpath.path_len--;
dir = ud->walkpath.path[ud->walkpath.path_len];
if(dir&1)
@@ -70,12 +71,6 @@ int unit_walktoxy_sub(struct block_list *bl)
ud->to_x -= dirx[dir];
ud->to_y -= diry[dir];
}
- if (!ud->walkpath.path_len) {
- //Already within requested range.
- if (ud->target && ud->state.attack_continue)
- unit_attack(bl, ud->target, 1);
- return 0;
- }
}
ud->state.change_walk_target=0;
@@ -314,7 +309,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
ud->state.walk_easy = flag&1;
ud->target = tbl->id;
- ud->chaserange = range;
+ ud->chaserange = range; //Note that if flag&2, this SHOULD be attack-range
ud->state.attack_continue = flag&2?1:0; //Chase to attack.
sc = status_get_sc(bl);