Also search for maps with sha256 in downloadedmaps

Additionally, forget the extra map details after disconnecting, they
shouldn't be used for the next server.
This commit is contained in:
heinrich5991 2018-06-24 16:56:09 +02:00
parent ca8fcc823c
commit ab55bcd9c8

View file

@ -754,6 +754,7 @@ void CClient::DisconnectWithReason(const char *pReason)
m_MapdownloadCrc = 0; m_MapdownloadCrc = 0;
m_MapdownloadTotalsize = -1; m_MapdownloadTotalsize = -1;
m_MapdownloadAmount = 0; m_MapdownloadAmount = 0;
m_MapDetailsPresent = false;
// clear the current server info // clear the current server info
mem_zero(&m_CurrentServerInfo, sizeof(m_CurrentServerInfo)); mem_zero(&m_CurrentServerInfo, sizeof(m_CurrentServerInfo));
@ -1135,6 +1136,15 @@ const char *CClient::LoadMapSearch(const char *pMapName, SHA256_DIGEST *pWantedS
return pError; return pError;
// try the downloaded maps // try the downloaded maps
if(pWantedSha256)
{
str_format(aBuf, sizeof(aBuf), "downloadedmaps/%s_%08x_%s.map", pMapName, WantedCrc, aWantedSha256);
pError = LoadMap(pMapName, aBuf, pWantedSha256, WantedCrc);
if(!pError)
return pError;
}
// try the downloaded maps folder without appending the sha256
str_format(aBuf, sizeof(aBuf), "downloadedmaps/%s_%08x.map", pMapName, WantedCrc); str_format(aBuf, sizeof(aBuf), "downloadedmaps/%s_%08x.map", pMapName, WantedCrc);
pError = LoadMap(pMapName, aBuf, pWantedSha256, WantedCrc); pError = LoadMap(pMapName, aBuf, pWantedSha256, WantedCrc);
if(!pError) if(!pError)