2021-05-04 14:01:47 +00:00
|
|
|
#include "pkt_01_welcome.h"
|
2021-05-04 17:39:50 +00:00
|
|
|
#include "world.h"
|
2021-05-03 22:44:39 +00:00
|
|
|
|
2021-05-04 11:04:15 +00:00
|
|
|
pkt_desc pkt_01_welcome_desc[] = {
|
2021-05-04 17:39:50 +00:00
|
|
|
{ PKT_FIELD(CWP_ITEM_POSITIVE_INTEGER, pkt_01_welcome, block_size) },
|
2021-05-03 23:57:19 +00:00
|
|
|
{ PKT_FIELD(CWP_ITEM_POSITIVE_INTEGER, pkt_01_welcome, chunk_size) },
|
2021-05-04 17:39:50 +00:00
|
|
|
{ PKT_FIELD(CWP_ITEM_POSITIVE_INTEGER, pkt_01_welcome, world_size) },
|
2021-05-03 23:57:19 +00:00
|
|
|
{ PKT_END },
|
|
|
|
};
|
2021-05-03 22:44:39 +00:00
|
|
|
|
2021-05-04 11:04:15 +00:00
|
|
|
size_t pkt_01_welcome_encode(pkt_01_welcome *table) {
|
|
|
|
cw_pack_context pc = {0};
|
|
|
|
pkt_pack_msg(&pc, 3);
|
|
|
|
pkt_pack_struct(&pc, pkt_01_welcome_desc, PKT_STRUCT_PTR(table));
|
|
|
|
return pkt_pack_msg_size(&pc);
|
|
|
|
}
|
|
|
|
|
2021-05-03 22:44:39 +00:00
|
|
|
int32_t pkt_01_welcome_handler(pkt_header *header) {
|
|
|
|
pkt_01_welcome table;
|
2021-05-04 11:04:15 +00:00
|
|
|
PKT_IF(pkt_msg_decode(header, pkt_01_welcome_desc, 3, PKT_STRUCT_PTR(&table)));
|
2021-05-03 22:44:39 +00:00
|
|
|
|
2021-05-04 17:39:50 +00:00
|
|
|
zpl_printf("we received: block_size: %d, chunk_size: %d and world_size: %d\n", table.block_size, table.chunk_size, table.world_size);
|
|
|
|
|
|
|
|
world_init_minimal(table.block_size, table.chunk_size, table.world_size, NULL, NULL);
|
2021-05-03 22:44:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|