pkt_send_librg_update

isolation_bkp/dynres
Dominik Madarász 2021-05-10 16:33:32 +02:00
parent f1a7c96135
commit 5d9f44f2b0
3 changed files with 14 additions and 1 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}
}