]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
print a message and call CL_BeginDownloads if a download is corrupt
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Jun 2007 04:06:16 +0000 (04:06 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 14 Jun 2007 04:06:16 +0000 (04:06 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7416 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c

index 31afbd1f61d8b25efb347c9085a95932f6f4e514..9974a30b37097d342a8a910d6ccd01da16346073 100644 (file)
@@ -1154,7 +1154,7 @@ void CL_BeginDownloads_f(void)
 
 void CL_StopDownload(int size, int crc)
 {
-       if (cls.qw_downloadmemory && cls.qw_downloadmemorycursize == size && CRC_Block(cls.qw_downloadmemory, size) == crc)
+       if (cls.qw_downloadmemory && cls.qw_downloadmemorycursize == size && CRC_Block(cls.qw_downloadmemory, cls.qw_downloadmemorycursize) == crc)
        {
                int existingcrc;
                size_t existingsize;
@@ -1192,6 +1192,11 @@ void CL_StopDownload(int size, int crc)
                                FS_Rescan();
                }
        }
+       else if (cls.qw_downloadmemory && size)
+       {
+               Con_Printf("Download \"%s\" is corrupt (%i bytes, %i CRC, should be %i bytes, %i CRC), discarding\n", cls.qw_downloadname, size, crc, (int)cls.qw_downloadmemorycursize, (int)CRC_Block(cls.qw_downloadmemory, cls.qw_downloadmemorycursize));
+               CL_BeginDownloads(true);
+       }
 
        if (cls.qw_downloadmemory)
                Mem_Free(cls.qw_downloadmemory);