Merge branch 'SQC-15_online' of https://github.com/CegepSTH/SQCSim2023 into SQC-15_online

This commit is contained in:
Claudel-D-Roy 2023-12-06 16:21:06 -05:00
commit 8eb2de4cd9
2 changed files with 5 additions and 11 deletions

View File

@ -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;
}
@ -930,17 +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;
for (int x = 0; x < 140; ++x)
std::cout << buf[sizeof(uint64_t) * 3 + x];
std::cout << messsize << ": " << &buf[1 + sizeof(uint64_t) * 3] << std::endl;
memcpy(&chat->mess, &buf[1 + sizeof(uint64_t) * 3], messsize);
strcpy(chat->mess, messsize, &buf[1 + sizeof(uint64_t) * 3]);
*buflen = messsize + sizeof(uint64_t) * 3 + 2;
//*buflen = messsize + sizeof(uint64_t) * 3 + 1;
return true;
}

View File

@ -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;
}