Skip to content

Commit 775ab47

Browse files
committed
Fix bugus "wrong checksum" error after downloading pk3
This commit also fixes bug in ignored downloads feature where ignored file would get wrong checksum saved to dlblacklist.dat and not get ignored in some cases
1 parent 3d0b200 commit 775ab47

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/qcommon/files.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3273,13 +3273,15 @@ qboolean FS_ComparePaks( char *neededpaks, int len, int *chksums, size_t maxchks
32733273
searchpath_t *sp;
32743274
qboolean havepak, badchecksum, badname;
32753275
int i;
3276+
int paknum; // number of paks in neededpaks string (not counting dl_ duplicates)
32763277

32773278
if ( !fs_numServerReferencedPaks ) {
32783279
return qfalse; // Server didn't send any pack information along
32793280
}
32803281

32813282
*neededpaks = 0;
32823283
badname = qfalse;
3284+
paknum = 0;
32833285

32843286
for ( i = 0 ; i < fs_numServerReferencedPaks ; i++ ) {
32853287
// Ok, see if we have this pak file
@@ -3355,11 +3357,14 @@ qboolean FS_ComparePaks( char *neededpaks, int len, int *chksums, size_t maxchks
33553357
break;
33563358
}
33573359

3358-
Q_strcat( neededpaks, len, currentPak );
3359-
3360-
if (chksums && i < (int)maxchksums) {
3361-
chksums[i] = fs_serverReferencedPaks[i];
3360+
if (paknum + 1 >= (int)maxchksums) {
3361+
Com_Printf( S_COLOR_YELLOW "WARNING (FS_ComparePaks): referenced pk3 files cut off because there are too many\n" );
3362+
break;
33623363
}
3364+
3365+
Q_strcat( neededpaks, len, currentPak );
3366+
chksums[paknum] = fs_serverReferencedPaks[i];
3367+
paknum++;
33633368
} else {
33643369
char st[MAX_ZPATH];
33653370

@@ -3370,6 +3375,7 @@ qboolean FS_ComparePaks( char *neededpaks, int len, int *chksums, size_t maxchks
33703375
if ( FS_SV_FileExists(va("%s/dl_%s.pk3", moddir, filename)) ) {
33713376
Q_strcat( neededpaks, len, " (local file exists with wrong checksum)");
33723377
}
3378+
33733379
Q_strcat( neededpaks, len, "\n");
33743380
}
33753381
}

0 commit comments

Comments
 (0)