diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-17 03:47:29 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-17 03:47:29 +0000 |
commit | 2c5ef4009772b5472f4268ec93544ebfa87798f1 (patch) | |
tree | 5e07bdca010d1b3817ad6d5ee480359a4a207efa | |
parent | da6be30cb73337b59bea5e53c3f3b099369de661 (diff) | |
download | hercules-2c5ef4009772b5472f4268ec93544ebfa87798f1.tar.gz hercules-2c5ef4009772b5472f4268ec93544ebfa87798f1.tar.bz2 hercules-2c5ef4009772b5472f4268ec93544ebfa87798f1.tar.xz hercules-2c5ef4009772b5472f4268ec93544ebfa87798f1.zip |
- Fixed the first call to the walk timers having the tick interval halved, which made all walking timers be off by half cell with the actual position displayed client-side.
- Changed the data component of the walktoxy timers to hold the speed (timer interval) so that when you are halted when walking, if you have walked more than half the distance to the next cell, your position is fixed at the next cell.
- If you are halted (damaged) while walking and before reaching the first cell of your walking path, then you are halted at the next cell, this effectively will block stun-lock regardless of aspd of the attacker.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6127 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 9 | ||||
-rw-r--r-- | src/map/unit.c | 19 |
2 files changed, 23 insertions, 5 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 8fc9dbcaf..6ceea49bc 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,15 @@ 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/16
+ * Fixed the first call to the walk timers having the tick interval halved,
+ which made all walking timers be off by half cell with the actual position
+ displayed client-side (so everyone reaches destination cell server-side
+ half-cell before the client). [Skotlex]
+ * Fixed being halted when you are walking so that: 1. Your position
+ refreshed on the screen is correct (the current tile if you haven't reached
+ at least half path between the current and next tile and the next tile
+ otherwise) and 2. If you are halted before walking even one cell, you will
+ be moved to the next cell (to effectively prevent stun-locking). [Skotlex]
* Modified @monster command to use map_search_freecell (prevents mobs
spawning on non-walkable tiles) [Skotlex]
* Modified @nuke to invoke skill_cast_nodamage_id instead of the damage_id
diff --git a/src/map/unit.c b/src/map/unit.c index 81b6f5af7..82f628a2a 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -85,10 +85,8 @@ int unit_walktoxy_sub(struct block_list *bl) i = status_get_speed(bl)*14/10;
else
i = status_get_speed(bl);
- if( i > 0) {
- i = i>>1;
+ if( i > 0) //First time data is sent as 0 to always enable moving one tile when hit.
ud->walktimer = add_timer(gettick()+i,unit_walktoxy_timer,bl->id,0);
- }
return 1;
}
@@ -121,7 +119,7 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data) ud->walktimer=-1;
if( bl->prev == NULL ) return 0; // block_list から抜けているので移動停止する
- if(ud->walkpath.path_pos>=ud->walkpath.path_len || ud->walkpath.path_pos!=data)
+ if(ud->walkpath.path_pos>=ud->walkpath.path_len)
return 0;
//歩いたので息吹のタイマーを初期化
@@ -211,7 +209,7 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data) i = status_get_speed(bl);
if(i > 0)
- ud->walktimer = add_timer(tick+i,unit_walktoxy_timer,id,ud->walkpath.path_pos);
+ ud->walktimer = add_timer(tick+i,unit_walktoxy_timer,id,i);
else if(sd && sd->sc.count && sd->sc.data[SC_RUN].timer!=-1) //Keep trying to run.
pc_run(sd, sd->sc.data[SC_RUN].val1, sd->sc.data[SC_RUN].val2);
else if (ud->target) {
@@ -633,8 +631,19 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int ud->canmove_tick = tick + delay;
if (ud->walktimer != -1)
{ //Stop walking, if chasing, readjust timers.
+ struct TimerData *data = get_timer(ud->walktimer);
+ //NOTE: We are using timer data after deleting it because we know the
+ //delete_timer function does not messes with it. If the function's
+ //behaviour changes in the future, this code could break!
delete_timer(ud->walktimer, unit_walktoxy_timer);
ud->walktimer = -1;
+ ud->state.change_walk_target = 0;
+ if (data && (!data->data || DIFF_TICK(data->tick, tick) <= data->data/2))
+ { //Enough time has elapsed to allow for one more tile,
+ //Or this is the first iteration of the walk
+ ud->walkpath.path_len = ud->walkpath.path_pos+1;
+ unit_walktoxy_timer(-1, tick, bl->id, ud->walkpath.path_pos);
+ }
clif_fixpos(bl);
if(ud->target)
add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
|