1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-26 16:09:10 +00:00

Codechange: [Network] Use std::string to get a NewGRF's name

This commit is contained in:
rubidium42
2021-05-30 13:34:58 +02:00
committed by rubidium42
parent 849a10520c
commit ab9b937ab7
3 changed files with 5 additions and 6 deletions

View File

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