summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/clif.c1
-rw-r--r--src/map/unit.c22
3 files changed, 20 insertions, 5 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 978037dcb..3cc96dba3 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.
2007/02/09
+ * Updated the 'unit walk' to functions so they stop your attack if it's
+ possible to walk.
* Fixed char server SQL not sending the guild info update to other map
servers when a new member is added.
2007/02/08
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);
}