summaryrefslogtreecommitdiff
path: root/src/map/send.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-30 17:11:40 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-30 17:48:44 +0300
commit5232d8fa98cbfb7a85e15b182eeb1e22d5b7376a (patch)
tree02fb3608af73a948adef7787e8f2ffd562b3c7d1 /src/map/send.c
parent4597146d5a26105130d2181cfae5403bd3013366 (diff)
downloadevol-hercules-5232d8fa98cbfb7a85e15b182eeb1e22d5b7376a.tar.gz
evol-hercules-5232d8fa98cbfb7a85e15b182eeb1e22d5b7376a.tar.bz2
evol-hercules-5232d8fa98cbfb7a85e15b182eeb1e22d5b7376a.tar.xz
evol-hercules-5232d8fa98cbfb7a85e15b182eeb1e22d5b7376a.zip
map: send full moving path to client.
Also fix memory issue in string translation.
Diffstat (limited to 'src/map/send.c')
-rw-r--r--src/map/send.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/map/send.c b/src/map/send.c
index 59402ad..b3ab051 100644
--- a/src/map/send.c
+++ b/src/map/send.c
@@ -12,6 +12,7 @@
#include "../../../common/strlib.h"
#include "../../../map/mob.h"
#include "../../../map/pc.h"
+#include "../../../map/unit.h"
#include "map/send.h"
@@ -119,3 +120,33 @@ void send_mob_info(struct block_list* bl1, struct block_list* bl2,
clif->send(&buf, sizeof(buf), bl2, target);
}
+
+void send_advmoving(struct unit_data* ud, struct block_list *tbl, enum send_target target)
+{
+ if (!ud)
+ return;
+
+ struct block_list *bl = ud->bl;
+
+ if (ud->walkpath.path_len <= ud->walkpath.path_pos)
+ return;
+ const bool haveMoves = (ud->walkpath.path_len > ud->walkpath.path_pos);
+
+ int i = 14;
+ const int len = ud->walkpath.path_len - ud->walkpath.path_pos;
+ if (haveMoves)
+ i += len;
+
+ char *buf;
+ CREATE(buf, char, i);
+ WBUFW (buf, 0) = 0xb04;
+ WBUFW (buf, 2) = i;
+ WBUFL (buf, 4) = bl->id;
+ WBUFW (buf, 8) = status->get_speed(bl);
+ WBUFW (buf, 10) = bl->x;
+ WBUFW (buf, 12) = bl->y;
+ if (haveMoves)
+ memcpy(buf + 14, ud->walkpath.path + ud->walkpath.path_pos, len);
+ clif->send(buf, i, tbl, target);
+ aFree(buf);
+}