summaryrefslogtreecommitdiff
path: root/src/map/clif.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/clif.c
parent4597146d5a26105130d2181cfae5403bd3013366 (diff)
downloadplugin-5232d8fa98cbfb7a85e15b182eeb1e22d5b7376a.tar.gz
plugin-5232d8fa98cbfb7a85e15b182eeb1e22d5b7376a.tar.bz2
plugin-5232d8fa98cbfb7a85e15b182eeb1e22d5b7376a.tar.xz
plugin-5232d8fa98cbfb7a85e15b182eeb1e22d5b7376a.zip
map: send full moving path to client.
Also fix memory issue in string translation.
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index f92a9f7..4e7f47b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -78,7 +78,8 @@ void eclif_charnameack(int *fdPtr, struct block_list *bl)
int fd = *fdPtr;
struct map_session_data* sd = (struct map_session_data*)session[fd]->session_data;
const char *tr = lang_pctrans(((TBL_NPC*)bl)->name, sd);
- const int len = 8 + strlen(tr) + 1;
+ const int trLen = strlen(tr);
+ const int len = 8 + trLen + 1;
// if no recipient specified just update nearby clients
if (fd == 0)
{
@@ -87,7 +88,7 @@ void eclif_charnameack(int *fdPtr, struct block_list *bl)
WBUFW(buf, 0) = 0xB01;
WBUFW(buf, 2) = len;
WBUFL(buf, 4) = bl->id;
- memcpy(WBUFP(buf, 8), tr, len);
+ memcpy(WBUFP(buf, 8), tr, trLen);
clif->send(buf, len, bl, AREA);
aFree(buf);
}
@@ -97,7 +98,7 @@ void eclif_charnameack(int *fdPtr, struct block_list *bl)
WFIFOW(fd, 0) = 0xB01;
WFIFOW(fd, 2) = len;
WFIFOL(fd, 4) = bl->id;
- memcpy(WFIFOP(fd, 8), tr, len);
+ memcpy(WFIFOP(fd, 8), tr, trLen);
WFIFOSET(fd, len);
}
}
@@ -182,7 +183,7 @@ void eclif_sendlook(struct block_list *bl, int *id, int *type, int *val, int *va
bool eclif_send(const void* buf, int *len, struct block_list* bl, enum send_target *type)
{
if (*type == SELF)
- return;
+ return true;
eclif_handle_invisible_map(bl, *type);
return true;
}
@@ -200,13 +201,14 @@ int eclif_send_actual(int *fd, void *buf, int *len)
if (*len >= 2)
{
const int packet = RBUFW (buf, 0);
- if (packet == 0xb02 || packet == 0xb03)
+ if (packet >= 0xb02 && packet <= 0xb05)
{
struct SessionExt *data = session_get(*fd);
if (!data)
return 0;
if (data->clientVersion < 3)
{ // not sending new packets to old clients
+ ShowWarning("skip packet %d\n", packet);
hookStop();
return 0;
}
@@ -224,3 +226,14 @@ void eclif_set_unit_idle_post(struct block_list* bl, struct map_session_data *ts
if (bl->type == BL_MOB && tsd)
send_mob_info(bl, tsd ? &tsd->bl : bl, *target);
}
+
+void eclif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
+ struct unit_data* ud, enum send_target *target)
+{
+ send_advmoving(ud, tsd ? &tsd->bl : bl, *target);
+}
+
+void eclif_move(struct unit_data *ud)
+{
+ send_advmoving(ud, ud->bl, AREA_WOS);
+}