Merge pull request #136 from Learath2/pr_CrcFail

Fix for the crc fail fallback.
This commit is contained in:
Dennis Felsing 2015-01-19 23:56:40 +01:00
commit 554342eb3f

View file

@ -1576,7 +1576,11 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
m_MapdownloadAmount += Size; m_MapdownloadAmount += Size;
if(Last) if(Last)
{
if(m_MapdownloadFile)
io_close(m_MapdownloadFile);
FinishMapDownload(); FinishMapDownload();
}
else else
{ {
// request new chunk // request new chunk
@ -2113,8 +2117,6 @@ void CClient::ResetMapDownload()
delete m_pMapdownloadTask; delete m_pMapdownloadTask;
m_pMapdownloadTask = NULL; m_pMapdownloadTask = NULL;
} }
if(m_MapdownloadFile)
io_close(m_MapdownloadFile);
m_MapdownloadFile = 0; m_MapdownloadFile = 0;
m_MapdownloadAmount = 0; m_MapdownloadAmount = 0;
} }
@ -2124,24 +2126,30 @@ void CClient::FinishMapDownload()
const char *pError; const char *pError;
m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client/network", "download complete, loading map"); m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client/network", "download complete, loading map");
ResetMapDownload(); int prev = m_MapdownloadTotalsize;
m_MapdownloadTotalsize = -1; m_MapdownloadTotalsize = -1;
// load map // load map
pError = LoadMap(m_aMapdownloadName, m_aMapdownloadFilename, m_MapdownloadCrc); pError = LoadMap(m_aMapdownloadName, m_aMapdownloadFilename, m_MapdownloadCrc);
if(!pError) if(!pError)
{ {
ResetMapDownload();
m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client/network", "loading done"); m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client/network", "loading done");
SendReady(); SendReady();
} }
else if(m_pMapdownloadTask) else if(m_pMapdownloadTask)
{ {
ResetMapDownload(); ResetMapDownload();
m_MapdownloadTotalsize = prev;
SendMapRequest(); SendMapRequest();
} }
else else{
if(m_MapdownloadFile)
io_close(m_MapdownloadFile);
ResetMapDownload();
DisconnectWithReason(pError); DisconnectWithReason(pError);
} }
}
void CClient::PumpNetwork() void CClient::PumpNetwork()
{ {