summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-27 21:00:39 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-27 21:00:39 +0000
commit7fde5cda86f543434529e5e5a79152091ca90744 (patch)
tree0db86210b49f6cae9efed842db00206b217fe1ae /src/map/clif.c
parent85127739369c09fb398de34b2d39fe5af4ca11ed (diff)
downloadhercules-7fde5cda86f543434529e5e5a79152091ca90744.tar.gz
hercules-7fde5cda86f543434529e5e5a79152091ca90744.tar.bz2
hercules-7fde5cda86f543434529e5e5a79152091ca90744.tar.xz
hercules-7fde5cda86f543434529e5e5a79152091ca90744.zip
- unit_remove_map will reset attackable-time, canact and canwalk delays.
- Added a timer in clif.c so that walk requests that are done while your cannot move duration will be delayed and processed afterwards (as long as the walk delay remaining is less than 2000 ms) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6329 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 4fdccec63..8156d9e48 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8194,6 +8194,24 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) {
clif_servertick(sd);
}
+static int clif_walktoxy_timer(int tid, unsigned int tick, int id, int data)
+{
+ struct map_session_data *sd;
+ short x,y;
+
+ if (!session[id] || (sd = session[id]->session_data) == NULL)
+ return 0;
+
+ if (!unit_can_move(&sd->bl))
+ return 0;
+
+ x = data>>16;
+ y = data&0xffff;
+
+ unit_walktoxy(&sd->bl, x, y, 0);
+ return 1;
+}
+
/*==========================================
*
*------------------------------------------
@@ -8201,6 +8219,7 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) {
void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
int x, y;
int cmd;
+ unsigned int tick;
RFIFOHEAD(fd);
if (pc_isdead(sd)) {
@@ -8215,8 +8234,6 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
return;
pc_stop_attack(sd);
- if (!unit_can_move(&sd->bl))
- return;
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
@@ -8228,9 +8245,17 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
(RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0] + 2) >> 4);
//Set last idle time... [Skotlex]
sd->idletime = last_tick;
-
+
+ tick = gettick();
+ if (DIFF_TICK(sd->ud.canmove_tick, tick) > 0 &&
+ DIFF_TICK(sd->ud.canmove_tick, tick) < 2000)
+ { // Delay walking command. [Skotlex]
+ add_timer(sd->ud.canmove_tick+1, clif_walktoxy_timer, fd, (x<<16)|y);
+ return;
+ }
+ if (!unit_can_move(&sd->bl))
+ return;
unit_walktoxy(&sd->bl, x, y, 0);
-
}
/*==========================================
@@ -11625,7 +11650,7 @@ int do_init_clif(void) {
add_timer_func_list(clif_clearchar_delay_sub, "clif_clearchar_delay_sub");
add_timer_func_list(clif_delayquit, "clif_delayquit");
add_timer_func_list(clif_nighttimer, "clif_nighttimer");
-
+ add_timer_func_list(clif_walktoxy_timer, "clif_walktoxy_timer");
return 0;
}