From 5d9f44f2b0b23d2431d58443aac51462e507b0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Mon, 10 May 2021 16:33:32 +0200 Subject: [PATCH] pkt_send_librg_update --- code/common/packets/pkt_send_librg_update.c | 8 ++++++++ code/common/packets/pkt_send_librg_update.h | 5 +++++ code/common/world/world.c | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/code/common/packets/pkt_send_librg_update.c b/code/common/packets/pkt_send_librg_update.c index c4dc7bb..09e31c9 100644 --- a/code/common/packets/pkt_send_librg_update.c +++ b/code/common/packets/pkt_send_librg_update.c @@ -4,6 +4,14 @@ #include "world/world.h" #include "game.h" +size_t pkt_send_librg_update(uint64_t peer_id, + uint16_t view_id, + uint8_t ticker, + void *data, + size_t datalen) { + return pkt_world_write(MSG_ID_LIBRG_UPDATE, pkt_send_librg_update_encode(data, (int32_t)datalen, ticker), 1, view_id, peer_id); +} + size_t pkt_send_librg_update_encode(void *data, int32_t data_length, uint8_t layer_id) { cw_pack_context pc = {0}; pkt_pack_msg(&pc, 2); diff --git a/code/common/packets/pkt_send_librg_update.h b/code/common/packets/pkt_send_librg_update.h index 246ce7f..90aa41e 100644 --- a/code/common/packets/pkt_send_librg_update.h +++ b/code/common/packets/pkt_send_librg_update.h @@ -2,6 +2,11 @@ #include "system.h" #include "packet_utils.h" +size_t pkt_send_librg_update(uint64_t peer_id, + uint16_t view_id, + uint8_t ticker, + void *data, + size_t datalen); size_t pkt_send_librg_update_encode(void *data, int32_t data_length, uint8_t layer_id); PKT_HANDLER_PROC(pkt_send_librg_update_handler); diff --git a/code/common/world/world.c b/code/common/world/world.c index 8db96ec..0d24a6d 100644 --- a/code/common/world/world.c +++ b/code/common/world/world.c @@ -211,7 +211,7 @@ static void world_tracker_update(uint8_t ticker, uint32_t freq, uint8_t radius) zpl_printf("[error] an error happened writing the world %d\n", result); } - pkt_world_write(MSG_ID_LIBRG_UPDATE, pkt_send_librg_update_encode(buffer, (int32_t)datalen, ticker), 1, p[i].view_id, (void*)p[i].peer); + pkt_send_librg_update((void*)p[i].peer, p[i].view_id, ticker, buffer, datalen); } } }