1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 02:12:37 +01:00

Codechange: Use Recv/Send_bytes for md5sum. (#12602)

Use existing functions to handle serialisation of arrays instead of indexed for-loop.
This commit is contained in:
Peter Nelson
2024-05-01 18:55:54 +01:00
committed by GitHub
parent 1424a184d8
commit 532ce1a907
2 changed files with 4 additions and 13 deletions

View File

@@ -63,9 +63,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_INFO(Packet &p)
ci->description = p.Recv_string(NETWORK_CONTENT_DESC_LENGTH, SVS_REPLACE_WITH_QUESTION_MARK | SVS_ALLOW_NEWLINE);
ci->unique_id = p.Recv_uint32();
for (size_t j = 0; j < ci->md5sum.size(); j++) {
ci->md5sum[j] = p.Recv_uint8();
}
p.Recv_bytes(ci->md5sum);
uint dependency_count = p.Recv_uint8();
ci->dependencies.reserve(dependency_count);
@@ -276,10 +274,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo
p->Send_uint8((uint8_t)ci->type);
p->Send_uint32(ci->unique_id);
if (!send_md5sum) continue;
for (size_t j = 0; j < ci->md5sum.size(); j++) {
p->Send_uint8(ci->md5sum[j]);
}
p->Send_bytes(ci->md5sum);
}
this->SendPacket(std::move(p));