Do not unpack map data packet if no map download is progress

There is no need to unpack map data packets if the client receives any without expecting them.
This commit is contained in:
Robert Müller 2024-03-23 17:55:03 +01:00
parent b264570218
commit 9ffa9d8e0a

View file

@ -1468,12 +1468,17 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
} }
else if(Conn == CONN_MAIN && Msg == NETMSG_MAP_DATA) else if(Conn == CONN_MAIN && Msg == NETMSG_MAP_DATA)
{ {
if(!m_MapdownloadFileTemp)
{
return;
}
int Last = Unpacker.GetInt(); int Last = Unpacker.GetInt();
int MapCRC = Unpacker.GetInt(); int MapCRC = Unpacker.GetInt();
int Chunk = Unpacker.GetInt(); int Chunk = Unpacker.GetInt();
int Size = Unpacker.GetInt(); int Size = Unpacker.GetInt();
const unsigned char *pData = Unpacker.GetRaw(Size); const unsigned char *pData = Unpacker.GetRaw(Size);
if(Unpacker.Error() || Size <= 0 || MapCRC != m_MapdownloadCrc || Chunk != m_MapdownloadChunk || !m_MapdownloadFileTemp) if(Unpacker.Error() || Size <= 0 || MapCRC != m_MapdownloadCrc || Chunk != m_MapdownloadChunk)
{ {
return; return;
} }