diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-02-09 19:50:57 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-02-09 19:50:57 +0000 |
commit | bb1860600e59dacef19e8fd3e24417a92fde5113 (patch) | |
tree | 77361f24ebe3aff111920d27e107bbe8314e02f2 /src/map | |
parent | a248d006c5018fd87d55e328ea6d008bf00e1d01 (diff) | |
download | hercules-bb1860600e59dacef19e8fd3e24417a92fde5113.tar.gz hercules-bb1860600e59dacef19e8fd3e24417a92fde5113.tar.bz2 hercules-bb1860600e59dacef19e8fd3e24417a92fde5113.tar.xz hercules-bb1860600e59dacef19e8fd3e24417a92fde5113.zip |
- Updated the 'unit walk' to functions so they stop your attack if it's possible to walk.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9837 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 1 | ||||
-rw-r--r-- | src/map/unit.c | 22 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index aa2091054..c8c021233 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8359,7 +8359,6 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { if(sd->sc.count && sd->sc.data[SC_RUN].timer != -1) return; - pc_stop_attack(sd); pc_delinvincibletimer(sd); cmd = RFIFOW(fd,0); diff --git a/src/map/unit.c b/src/map/unit.c index 2a360e6ab..18fffa7f5 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -43,6 +43,7 @@ struct unit_data* unit_bl2ud(struct block_list *bl) { return NULL; } +static int unit_attack_timer(int tid,unsigned int tick,int id,int data); static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data); int unit_walktoxy_sub(struct block_list *bl) @@ -309,9 +310,14 @@ int unit_walktoxy( struct block_list *bl, int x, int y, int flag) { // timer関数からunit_walktoxy_subを呼ぶようにする ud->state.change_walk_target = 1; return 1; - } else { - return unit_walktoxy_sub(bl); } + + if (ud->attacktimer != -1) { + delete_timer( ud->attacktimer, unit_attack_timer ); + ud->attacktimer = -1; + } + + return unit_walktoxy_sub(bl); } static int unit_walktobl_sub(int tid,unsigned int tick,int id,int data) @@ -366,13 +372,21 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int ud->state.change_walk_target = 1; return 1; } + if (DIFF_TICK(ud->canmove_tick, gettick()) > 0) { //Can't move, wait a bit before invoking the movement. add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target); return 1; - } else if (!unit_can_move(bl)) + } + + if (!unit_can_move(bl)) return 0; - + + if (ud->attacktimer != -1) { + delete_timer( ud->attacktimer, unit_attack_timer ); + ud->attacktimer = -1; + } + return unit_walktoxy_sub(bl); } |