summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index 8eb490c34..f5784b405 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -57,6 +57,7 @@
#include "common/showmsg.h"
#include "common/socket.h"
#include "common/timer.h"
+#include "common/utils.h"
#include <stdio.h>
#include <stdlib.h>
@@ -499,7 +500,7 @@ static int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data)
* @param tid: Timer ID, unused
* @param tick: Tick, unused
* @param id: ID of block_list to execute the action
- * @param data: intptr_t filled with x-coord in highest 16 bits and y-coord in lowest 16 bits
+ * @param data: uint32 data cast to intptr_t with x-coord in lowest 16 bits and y-coord in highest 16 bits
* @return 0: success, 1: failure
*/
static int unit_delay_walktoxy_timer(int tid, int64 tick, int id, intptr_t data)
@@ -507,8 +508,8 @@ static int unit_delay_walktoxy_timer(int tid, int64 tick, int id, intptr_t data)
struct block_list *bl = map->id2bl(id);
if (bl == NULL || bl->prev == NULL)
return 1;
- short x = (short) ((data >> 16) & 0xffff);
- short y = (short) (data & 0xffff);
+ short x = (short)GetWord((uint32)data, 0);
+ short y = (short)GetWord((uint32)data, 1);
unit->walktoxy(bl, x, y, 0);
return 0;
}
@@ -548,7 +549,7 @@ static int unit_walktoxy(struct block_list *bl, short x, short y, int flag)
if (flag&4 && DIFF_TICK(ud->canmove_tick, timer->gettick()) > 0 &&
DIFF_TICK(ud->canmove_tick, timer->gettick()) < 2000) {
// Delay walking command. [Skotlex]
- timer->add(ud->canmove_tick+1, unit->delay_walktoxy_timer, bl->id, (x<<16)|(y&0xFFFF));
+ timer->add(ud->canmove_tick + 1, unit->delay_walktoxy_timer, bl->id, (intptr_t)MakeDWord((uint16)x, (uint16)y));
return 1;
}