From ab9b937ab7a80562b88d72ec17c6b2a6b3ed2b61 Mon Sep 17 00:00:00 2001 From: rubidium42 Date: Sun, 30 May 2021 13:34:58 +0200 Subject: Codechange: [Network] Use std::string to get a NewGRF's name --- src/network/network_udp.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/network') diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp index 0da5a8b26..a0d9ae136 100644 --- a/src/network/network_udp.cpp +++ b/src/network/network_udp.cpp @@ -415,15 +415,14 @@ void ClientNetworkUDPSocketHandler::Receive_SERVER_NEWGRFS(Packet *p, NetworkAdd if (num_grfs > NETWORK_MAX_GRF_COUNT) return; for (i = 0; i < num_grfs; i++) { - char name[NETWORK_GRF_NAME_LENGTH]; GRFIdentifier c; DeserializeGRFIdentifier(p, &c); - p->Recv_string(name, sizeof(name)); + std::string name = p->Recv_string(NETWORK_GRF_NAME_LENGTH); /* An empty name is not possible under normal circumstances * and causes problems when showing the NewGRF list. */ - if (StrEmpty(name)) continue; + if (name.empty()) continue; /* Try to find the GRFTextWrapper for the name of this GRF ID and MD5sum tuple. * If it exists and not resolved yet, then name of the fake GRF is -- cgit v1.2.3-54-g00ecf