Rollover Beethoven

This commit is contained in:
MarcEricMartel
2023-12-06 15:37:08 -05:00
parent 6178604d95
commit 7077b617be
4 changed files with 35 additions and 19 deletions

View File

@@ -405,7 +405,14 @@ void netprot::Serialize(Chat* chat, char* buf[], uint32_t* buflen) {
size_t messize = std::strlen(chat->mess) + 1;
memcpy(*buf + 1 + sizeof(uint64_t) * 3, &chat->mess, messize);
std::cout << chat->mess << ": ";
strcpy(*buf + 1 + sizeof(uint64_t) * 3, messize, chat->mess);
//memcpy(*buf + 1 + sizeof(uint64_t) * 3, &chat->mess, messize);
for (int x = 0; x < sizeof(Chat); ++x)
std::cout << *(*buf + x);
*buflen = messize + sizeof(uint64_t) * 3 + 2;
}
@@ -928,6 +935,9 @@ bool netprot::Deserialize(Chat* chat, char* buf, uint32_t *buflen) {
if (messsize > 140)
return false;
for (int x = 0; x < 140; ++x)
std::cout << buf[sizeof(uint64_t) * 3 + x];
memcpy(&chat->mess, &buf[1 + sizeof(uint64_t) * 3], messsize);
*buflen = messsize + sizeof(uint64_t) * 3 + 2;

View File

@@ -129,7 +129,7 @@ namespace netprot {
Chat() {}
Chat(Chat* cha) : src_id(cha->src_id), dest_id(cha->dest_id), dest_team_id(cha->dest_team_id) {
strcpy(mess, 140, cha->mess); }
~Chat() { delete[] mess; }
~Chat() {/* delete[] mess; */}
};
struct ChunkMod {