summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorskyleo <skyleo@skyleo.de>2019-09-11 02:21:31 +0200
committerHaru <haru@dotalux.com>2020-03-08 20:56:28 +0100
commit769f5801f3499f525071cd0363ca9e66ef46f2cf (patch)
treecf703841d0dbd79a50312a5f1709666b8b5388aa /src/map/unit.c
parent02f661dc3b112efb9d4e61d3b15f9f0fa840e9ee (diff)
downloadhercules-769f5801f3499f525071cd0363ca9e66ef46f2cf.tar.gz
hercules-769f5801f3499f525071cd0363ca9e66ef46f2cf.tar.bz2
hercules-769f5801f3499f525071cd0363ca9e66ef46f2cf.tar.xz
hercules-769f5801f3499f525071cd0363ca9e66ef46f2cf.zip
Use *DWord functions for saving x & y into data of unit->delay_walktoxy_timer
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;
}