Fix djui_popup_create_global()
This commit is contained in:
parent
3e52c4f5db
commit
aaaf59e1e4
|
@ -7,16 +7,12 @@ void network_send_global_popup(const char* message, int lines) {
|
||||||
// get message length
|
// get message length
|
||||||
u16 messageLength = strlen(message);
|
u16 messageLength = strlen(message);
|
||||||
|
|
||||||
// make message mutable
|
|
||||||
char mutableMessage[messageLength];
|
|
||||||
strcpy(mutableMessage, message);
|
|
||||||
|
|
||||||
// configure packet
|
// configure packet
|
||||||
struct Packet p = { 0 };
|
struct Packet p = { 0 };
|
||||||
packet_init(&p, PACKET_GLOBAL_POPUP, true, PLMT_NONE);
|
packet_init(&p, PACKET_GLOBAL_POPUP, true, PLMT_NONE);
|
||||||
packet_write(&p, &lines, sizeof(int));
|
packet_write(&p, &lines, sizeof(int));
|
||||||
packet_write(&p, &messageLength, sizeof(u16));
|
packet_write(&p, &messageLength, sizeof(u16));
|
||||||
packet_write(&p, mutableMessage, messageLength * sizeof(u8));
|
packet_write(&p, (char*)message, messageLength * sizeof(u8));
|
||||||
|
|
||||||
// send the packet
|
// send the packet
|
||||||
network_send(&p);
|
network_send(&p);
|
||||||
|
@ -32,7 +28,7 @@ void network_receive_global_popup(struct Packet* p) {
|
||||||
packet_read(p, &lines, sizeof(int));
|
packet_read(p, &lines, sizeof(int));
|
||||||
packet_read(p, &messageLength, sizeof(u16));
|
packet_read(p, &messageLength, sizeof(u16));
|
||||||
if (messageLength >= 255) { messageLength = 255; }
|
if (messageLength >= 255) { messageLength = 255; }
|
||||||
packet_read(p, &message, messageLength * sizeof(u8));
|
packet_read(p, message, messageLength * sizeof(u8));
|
||||||
// show popup
|
// show popup
|
||||||
djui_popup_create(&message, lines);
|
djui_popup_create(message, lines);
|
||||||
}
|
}
|
Loading…
Reference in New Issue