This commit is contained in:
MarcEricMartel
2023-12-18 15:12:15 -05:00
parent f799e689d2
commit 6076b55267
2 changed files with 4 additions and 5 deletions

View File

@@ -217,9 +217,9 @@ void netprot::Serialize(Sync* sync, char* buf[], uint32_t* buflen) {
(boost.invincible ? 0b10000000 : 0) |
(boost.damage ? 0b01000000 : 0);
memcpy(*buf + sizeof(uint64_t) * 2 + sizeof(uint32_t) * 4 + sizeof(uint16_t) + 2, &boost8, sizeof(uint8_t));
memcpy(*buf + sizeof(uint64_t) * 2 + sizeof(uint32_t) * 5 + sizeof(uint16_t) + 1, &boost8, sizeof(uint8_t));
*buflen = sizeof(uint64_t) * 2 + sizeof(uint32_t) * 4 + sizeof(uint16_t) + sizeof(float) + 2;
*buflen = sizeof(uint64_t) * 2 + sizeof(uint32_t) * 5 + sizeof(uint16_t) + sizeof(float) + 2;
}
void netprot::Serialize(TeamInfo* tinfo, char* buf[], uint32_t* buflen) {
@@ -792,11 +792,11 @@ bool netprot::Deserialize(Sync* sync, char* buf, uint32_t* buflen) {
memcpy(&sync->hp, &hp, sizeof(float));
uint8_t boost = 0;
memcpy(&boost, &buf[2 + sizeof(uint64_t) * 2 + sizeof(uint32_t) * 4 + sizeof(uint16_t)], sizeof(uint8_t));
memcpy(&boost, &buf[2 + sizeof(uint64_t) * 2 + sizeof(uint32_t) * 5 + sizeof(uint16_t)], sizeof(uint8_t));
sync->boost.invincible = boost & 0b10000000;
sync->boost.damage = boost & 0b01000000;
*buflen = 2 + sizeof(uint64_t) * 2 + sizeof(uint32_t) * 4 + sizeof(uint16_t) + sizeof(float);
*buflen = 2 + sizeof(uint64_t) * 2 + sizeof(uint32_t) * 5 + sizeof(uint16_t) + sizeof(float);
return true;
}