From 449e12ca5a8347009411dfee5a1d2b6b423d8119 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Wed, 6 Dec 2023 16:01:29 -0500 Subject: [PATCH 1/2] GOT THE TIME TICK TICK TICKIN' IN MY HEAD --- SQCSim-common/netprotocol.cpp | 12 ++---------- SQCSim2021/engine.cpp | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/SQCSim-common/netprotocol.cpp b/SQCSim-common/netprotocol.cpp index a1e2b77..792364b 100644 --- a/SQCSim-common/netprotocol.cpp +++ b/SQCSim-common/netprotocol.cpp @@ -409,11 +409,6 @@ void netprot::Serialize(Chat* chat, char* buf[], uint32_t* buflen) { 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; } @@ -935,12 +930,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]; + strcpy(chat->mess, messsize, &buf[1 + sizeof(uint64_t) * 3]); - memcpy(&chat->mess, &buf[1 + sizeof(uint64_t) * 3], messsize); - - *buflen = messsize + sizeof(uint64_t) * 3 + 2; + *buflen = messsize + sizeof(uint64_t) * 3 + 1; return true; } diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index f405712..f4a9f00 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -668,7 +668,7 @@ int Engine::GetCountdown(float elapsedTime) { // if (m_countdown < m_time) {} // Stop(); //if (!m_stopcountdown) - // m_time += elapsedTime; + m_time += elapsedTime; return m_countdown;// -(int)m_time; } From d1805f2309267d3ad68d93424909263729dbd8b4 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Wed, 6 Dec 2023 16:20:59 -0500 Subject: [PATCH 2/2] Pleurer en chat. --- SQCSim-common/netprotocol.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SQCSim-common/netprotocol.cpp b/SQCSim-common/netprotocol.cpp index 792364b..5bad78b 100644 --- a/SQCSim-common/netprotocol.cpp +++ b/SQCSim-common/netprotocol.cpp @@ -925,14 +925,16 @@ bool netprot::Deserialize(Chat* chat, char* buf, uint32_t *buflen) { (uint64_t)dstt[6] << 8 | (uint64_t)dstt[7]; - size_t messsize = std::strlen(buf + sizeof(uint64_t) * 3) + 1; + size_t messsize = std::strlen(&buf[sizeof(uint64_t) * 3]) + 1; if (messsize > 140) return false; + std::cout << messsize << ": " << &buf[1 + sizeof(uint64_t) * 3] << std::endl; + strcpy(chat->mess, messsize, &buf[1 + sizeof(uint64_t) * 3]); - *buflen = messsize + sizeof(uint64_t) * 3 + 1; + //*buflen = messsize + sizeof(uint64_t) * 3 + 1; return true; }