Fix: comparison result is always the same warnings

This commit is contained in:
Rubidium
2023-01-12 20:23:56 +01:00
committed by rubidium42
parent b4f0450974
commit 6dfd2cad69
3 changed files with 21 additions and 20 deletions

View File

@@ -281,14 +281,14 @@ void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfo
}
case 4: {
GRFConfig **dst = &info->grfconfig;
uint i;
/* Ensure that the maximum number of NewGRFs and the field in the network
* protocol are matched to eachother. If that is not the case anymore a
* check must be added to ensure the received data is still valid. */
static_assert(std::numeric_limits<uint8>::max() == NETWORK_MAX_GRF_COUNT);
uint num_grfs = p->Recv_uint8();
/* Broken/bad data. It cannot have that many NewGRFs. */
if (num_grfs > NETWORK_MAX_GRF_COUNT) return;
for (i = 0; i < num_grfs; i++) {
GRFConfig **dst = &info->grfconfig;
for (uint i = 0; i < num_grfs; i++) {
NamedGRFIdentifier grf;
switch (newgrf_serialisation) {
case NST_GRFID_MD5: