diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 8fc9dbcafe..6ceea49bc9 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 81b6f5af79..82f628a2a6 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);